High / Low Entry EA

 

Hi All,

Having a funny one with a super simple EA and I'm not sure exactly what the matter is.  In principle I simply want to execute a buy trade when the current market price (Going by the Bid) is greater than previous day's high, and also the other way - selling when lower than previous low.

      PreviousDayHigh = iHigh(_Symbol, _Period, 1);
      PreviousDayLow = iLow(_Symbol, _Period, 1);

        if (Bid < PreviousDayLow)
         {
            SellMarket();
         }
         
         if (Bid > PreviousDayHigh)
         {
            BuyMarket();
         }

There is no problem anywhere else in the code as the subroutines Buy/Sell market are from other EA's that successfully execute trades.

The PreviousDayHigh/Low variables are extern double.

There is no issue flagged in the backtest journal, it compiles fine...just doesn't execute trades, I presume it is due to my inability to correctly use the language to identify the high/low value or perhaps the 'Bid' function.

The EA runs on the daily chart.

Any advice and help would be greatly appreciated!

 

Perhaps this adviser is suitable for you: Previous Day Two Pending Orders

Trading strategy

The strategy is initially based on the assumption that if the previous daily candle is broken, then the movement will continue.

Strategy Settings:

* Minimum size of the previous daily candle : (calculation depends on the set Price Type )

Previous Day Two Pending Orders

Previous Day Two Pending Orders
Previous Day Two Pending Orders
  • www.mql5.com
Стратегия первоначально строится на предположении, что если предыдущая дневная свеча будет пробита - то движение продолжится. * Минимальный размер предыдущей дневной свечи: (расчёт зависит от заданного Типа цен) * Отступ - минимальный отступ от цены бара, при выставлении может оказаться больше заданного из-за минимально-допустимого уровня...
 
  1. RainyDay: The PreviousDayHigh/Low variables are extern double.

    Don't modify externs. You can't modify inputs. That's not their function.

  2. RainyDay: it compiles fine...just doesn't execute trades, 
    Use the debugger or print out your variables, including _LastError and prices and . Do you really expect us to debug your code for you?
Reason: