EA is buying when candle hasn't formed yet help

 

***

how can i only buy @ the close not when the candle is still forming?

 trade.Buy(1.00,NULL,Ask,Ask-2.5 , Ask+3.5,"buying");


***

 

Buy when the bar open time changes.

Otherwise post the code.

Reason: