• Overview
  • Reviews (2)
  • Comments (1)

Grid and MA

This is a grid Expert Advisor. It features several trading strategies based on Moving Average. It works on minute bar Open prices. Virtual trailing stop, stop loss and take profit can be set in pips, in the deposit currency or as a percentage of the balance. Depending on the settings, different orders may be opened for diversifying risks. Their closure can be either an oppositely directed or unidirectional basket of orders.

The order grid is adaptive and is made of market orders. If the price has moved to the opposite side of the open order for a distance equal to OrderOpenStop + OrderOpenStep, the virtual level of opening a new order is set. If the price continues its movement in the opposite direction from the open order, the previously established order opening level is moved following the price. If the price touches or crosses a given level, a trade is opened. Thus, the most favorable price for opening positions in the order grid is achieved. The trading lot in the order grid is calculated on the basis of a given lot per 1000 units of the base currency multiplied by a factor or with a given summary lot.


  • Strategy - select the strategy;
    • MAPrice - price crossing the indicator line upwards/downwards.
    • DoubleMA - MA lines crossing each other. Buy - fast МА crosses the slow MA upwards, sell - fast МА crosses the slow MA downwards.
    • MAChannel - channel of moving averages is based on the High/Low price. Buy if Bid price is above the MA channel, sell if Bid price is below the MA channel.

More strategies based on Moving Average indicator may be added upon your request.


  • MATimeFrame - Moving Average timeframe;
  • MA1Period - fast MA period. For MAPrice and MAChannel strategies;
  • MA2Period - slow MA period. For DoubleMA strategies;
  • MAMethod - averaging method.
    • MODE_SMA - simple averaging.
    • MODE_EMA - exponential averaging.
    • MODE_SMMA - smoothed averaging.
    • MODE_LWMA - linear weighted averaging.
  • MAAppliedPrice - price type.
    • PRICE_CLOSE - Close price.
    • PRICE_OPEN - Open price.
    • PRICE_HIGH - High price for the period.
    • PRICE_LOW - Low price for the period.
    • PRICE_MEDIAN - Median price, (high+low)/2.
    • PRICE_TYPICAL - Typical price, (high+low+close)/3.
    • PRICE_WEIGHTED - weighted average price, (high+low+close+close)/4.
  • MAShift - shift.

Main parameters

  • LotsFor1000 - initial lot size per 1000 units of base currency;
  • LotMultiplier - lot multiplier for subsequent orders; if 1, does not change;
  • AddLot - additional lot for subsequent orders; if 1, does not change;
  • TradingMethod - trading method:
    • Unidirectional - trading is performed in a single direction;
    • Multidirectional - trading can be performed in two directions simultaneously;
  • OrderOpenStop - distance from the last open order to place the order grid;
  • OrderOpenStep - distance from the current price for setting the Open level of a new order in the order grid;
  • LevelsMethod - take profit/stop loss placement method:
    • Unidirectional - separate, for a basket of unidirectional orders;
    • Multidirectional - general, for a basket of multi-directional orders;
  • LevelsMode - select take profit/stop loss method:
    • Pips - in pips.
    • Money - in the deposit currency.
    • Percent - in balance %.
  • StopLoss - stop loss, -1 - not used;
  • TakeProfit - take profit, -1 - not used;
  • TrailingMethod - trailing stop operation methods:
    • Unidirectional - close the basket of unidirectional orders.
    • Multidirectional - close the basket of oppositely directed orders.
  • TrailingMode - select trailing stop mode:
    • Pips - in pips.
    • Money - in the deposit currency.
    • Percent - in balance %.
  • TrailingStop - trailing stop distance.
  • TrailingStep - trailing step.
  • MagicNumber - magic number. If -1, the EA works with all orders;
  • Comment - comment for trades.

jaras2539 2020.06.18 17:31 

Would be great if adjusted The lot can be started.

Ronaldo5 2020.02.08 07:36 

Very good EA easy setup, simple and effective.