• Información general
  • Comentarios
  • Discusión (1)

Grid and MACD

This is a grid Expert Advisor. It has several trading strategies based on the MACD indicator. The virtual trailing stop, stop loss, take profit levels can be set 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 orders grid is adaptive, only market orders are used in it. If the price moves the distance of OrderOpenStop+OrderOpenStep in the direction opposite to the opened order, then a virtual level for opening a new order is set. If the price continues moving in the opposite direction from the open order, the previously set order opening level is trailed after the price. If the price touches or crosses a given level, a deal is opened. This achieves the most profitable price for opening positions in the order grid. The lot size of the orders in the grid is calculated as: specified lot per 1000 units of the base currency, multiplied by the coefficient or with the specified additional lot.


Strategies

  • Strategy - select the strategy;
    • MACD - buy - the MACD indicator histogram crosses the signal line upwards, the histogram should be lower than the zero level and lower than the signal line before the intersection. For the sell deals, all these conditions are opposite.
    • MACDSample - strategy based on MACD, but taking into account the value of the TrendPeriod moving average, which should be higher on the current bar than on the previous bar, that is, rising (for buys). A deal is opened if one more condition is met - the absolute value of the histogram is greater than the value of the OpenLevel parameter (specified in the input parameters), multiplied by the point value of the current instrument in the quote currency. For the sell deals, all these conditions are opposite (except the last one).


Indicator Parameters

  • TimeFrame - timeframe of the MACDI indicator.
  • FastEma - fast MA period.
  • SlowEma - slow MA period.
  • Signal - signal line period.
  • OpenLevel - absolute value of the histogram.
  • TrendPeriod - value of the moving average.
  • AppliedPrice - 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;
  • Shift - 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.
  • TradeMethod - trading method:
    • Unidirectional - trading is performed in one direction.
    • Multidirectional - trading can be performed in two directions simultaneously.
  • OrderOpenStop - distance from the last opened order to place the order grid.
  • OrderOpenStep - distance from the current price to set the level for opening a new order in the order grid.
  • LevelsMethod - method for setting take profit/stop loss.
    • Unidirectional - separate, for the basket of unidirectional orders.
    • Multidirectional - common, for the basket of oppositely directed orders.
  • LevelsMode - select the take profit/stop loss mode:
    • Pips - in pips.
    • Money - in the deposit currency.
    • Percent - in balance %.
  • StopLoss - stop loss; not used if -1.
  • TakeProfit - take profit; not used if -1.
  • TrailingMethod - trailing stop operation method:
    • Unidirectional - close the basket of unidirectional orders.
    • Multidirectional - close the basket of oppositely directed orders.
  • TrailingMode - select the trailing stop mode:
    • Pips - in pips.
    • Money - in the deposit currency.
    • Percent - in balance %.
  • TrailingStop - trailing stop distance.
  • TrailingStep - trailing step.
  • MagicNumber - EA ID, if -1 the EA will work with all orders.
  • Comment - comment to trades.
No hay comentarios