Contrarian trade MA – EA MetaTrader 5

The author of the ideaΒ –Β Scriptor

mq5 code authorΒ –Β barabashkakvn

The Expert Advisor uses iMA (Moving Average, MA) indicator and W1 timeframe. A timeframe can also be set separately via the MA and OHLC: timeframe parameter. The Number of bars among which search is Highest and Lowest interval searches for highs and lows. Position size (Lots) and stop loss (Stop Loss) are set as well.

The EA opens only one position at a time, therefore it is able to work both on hedging and netting accounts.

Trading signals

  • max – maximum found value of High prices
  • min – minimum found value of Low prices
  • rates[1].close – Close price on bar #1
  • rates[0].openΒ – Open price on bar #1
  • ma[1] – Moving Average indicator value on bar #1
  X4Period_RSI_Arrows - indicator MetaTrader 5
Β Β Β Β Β Β if((max<rates[1].close) || (ma[1]>rates[0].open))
Β Β Β Β Β Β Β Β {
Β Β Β Β Β Β Β Β  ***
Β Β Β Β Β Β Β Β  BUY
Β Β Β Β Β Β Β Β  ***
Β Β Β Β Β Β Β Β }
Β Β Β Β Β Β else if((min>rates[1].close) || (ma[1]<rates[0].open))
Β Β Β Β Β Β Β Β {
Β Β Β Β Β Β Β Β  ***
Β Β Β Β Β Β Β Β  SELL
Β Β Β Β Β Β Β Β  ***
Β Β Β Β Β Β Β Β }



https://www.mql5.com/ru/code/22914

πŸ“ˆ ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks