Why is the trade not open?
i do not know but at first i can see that you are using zig and zag without prior initialization at least in first iteration of your while....
You agree to website policy and terms of use
However, I realised that no BUY order was opened on 14th Mar 10:15am even though a bullish engulfing candle was formed. When I run the EA on the strategy tester, it indicates that the order should be opened. What am I doing wrongly?
if (Time0 != Time[0]) { //Bullish Engulfing if (Open[1] <= Close[2] && Close[1] >= Open[2] && Open[2] - Close[2] > 10*Point && Close[1] - Open[1] > 10*Point) { int n, i; double zag, zig; i=0; while(n<2) { if(zig>0) zag=zig; zig=iCustom(NULL, 0, "ZigZag", 0, i); if(zig>0) n+=1; i++; } if (zag < zig) OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask - StopLoss*Point, Ask + TakeProfit*Point, "CANDLESTICKS", 12345, 0, Green); }Any help is very much appreciated.