How to Execute buy/sell order 10 seconds before candlestick close ?

 

Dear All,

Anyone know How to Execute buy/sell order "10 seconds" before candlestick close in mql4 ? please help on this. thank you very much in advance 

 
Paulf: Anyone know How to Execute buy/sell order "10 seconds" before candlestick close in mql4 ? please help on this. thank you very much in advance 

My monitoring the current time! — Date and Time - MQL4 Reference

 
When in doubt, think!
datetime candleStart = iTime(_Symbol, _Period, 0);
datetime candleEnd   = candleStart + PeriodSeconds();
datetime candlem10   = candleEnd - 10;
if(TimeCurrent() >= candlem10) Print("10 seconds per end");
 
Thanks William Roeder !!!