Mastering Contrarian Trading with Moving Averages in MetaTrader 5

Mike 2018.11.20 21:54 13 0 0
Attachments

Idea Originator: Scriptor

Code Author: barabashkakvn

This Expert Advisor (EA) leverages the iMA (Moving Average) indicator on a W1 timeframe, although you can customize the timeframe through the MA and OHLC: timeframe parameter. The Number of Bars for Highs and Lows controls the interval for identifying the highest and lowest prices. You can also set the position size (Lots) and stop loss (Stop Loss) according to your trading strategy.

One of the standout features of this EA is that it opens only one position at a time, making it suitable for both hedging and netting accounts.

Trading Signals Explained:

  • max - the highest value of High prices found
  • min - the lowest value of Low prices found
  • rates[1].close - Closing price on bar #1
  • rates[0].open - Opening price on bar #1
  • ma[1] - Moving Average value on bar #1

      if((max<rates[1].close) || (ma[1]>rates[0].open))
        {
          ***
        BUY
          ***
        }
      else if((min>rates[1].close) || (ma[1]<rates[0].open))
        {
          ***
        SELL
          ***
        }


List
Comments 0