EA doesn't buy at open but instead buys along the entire candle instead of a set price

 

I am using the trade.Buy function and for price I put iClose or iOpen(0). However it isnt following the command and is instead buying like this:

trade.Buy(0.01,NULL,iClose(NULL,PERIOD_M1,1),MathMin(low1,low2),Ask+3*ATR,NULL);

Any help would be amazing

 
It is buying at every tick because you probably haven't set a filter like:
If(OpenedOrders()==0)
//BUY

 
Kevin Keena:
It is buying at every tick because you probably haven't set a filter like:
If(OpenedOrders()==0)
//BUY

Hello Kevin, what exactly does that do? I tried that function and it has no effect.

I remember on mt4 it would only buy or sell on open price, How come is it ignoring my function now?