Forex - www.MetaTraderProgramming.eu

Expert Advisor

Forex - www.MetaTraderProgramming.eu

Structure of Expert Advisor

The fully automated trading program (Expert Advisor or robot) opens and closes positions, manages accounts and trades. Accordingly, its structure is made up of the following components.

Let us consider these elements.

Open Conditions

Open conditions means the rules that tell the Expert Advisor when to open a position. The openings may occur for example based on one or more indicators, when certain shapes are formed, at a reach of given price or time, or when any other conditions are met.

We can create very complex open conditions too. The limit is the dreamer's fantasy of the strategy.

Money Management

Money management is part of the program, that tells the size of the positions. Simply we can open all positions with the same fix lot size. And the robot can calculate the size of the position with a risk rate based on the equity and the StopLoss aswell. The size can depend on any other conditions also.

MetaTrader - www.MetaTraderProgramming.eu

Position Management

Position management is primarily meant to manage the stops. The value of the StopLoss and the TakeProfit is determined here.

We can use TrailingStop which operates in normal or in gradual mode. Also can the StopLoss depend on a signal of an indicator. We may use a so-called Break-Even-Point (BEP) function when the robot moves the StopLoss to the open price after reaching a predefined profit.

The stop system can work as a hidden stop system too. In this case, the StopLoss and TakeProfit levels are not sent to the brokerage. You can see the positions of the stops in the chart - shown by horisontal lines. And when the price reaches them, the robot will close the trades. The hidden stop system has advantages and disadvantages too.

Position Building

At position building the Expert Advisor opens second or subsequent positions in one time. The role of this function is increasing the size of the open position. When we plan position building, we should consider that when and with what kind of conditions to open additional positions. We have to think of their lot size. As well as we have to make decisions of the stop management when more positions are opened. The stops can be managed together or separately aswell.

Close Conditions

Like the open conditions, we have to plan the close conditions too. The positions can close at the stop levels. And we may use indicators to determine the closing price. Also can we use any other closing rules.

We can close one or more positions at once, or we can close one position in several steps using a part-closing function.

Other Functions

An Expert Advisor may have a number of other additional funcitons. Some of them are listed below:

  • Logging data to file
  • Making screenshots
  • Using buttons
  • E-mail sending
  • Copy protection
  • Reading data from file
  • Using different alarms
  • Communication
    between two MetaTraders
  • MetaTrader-Excel
    communication