EA "Trade Failure, Market Closed" help

 
I am programming an ea that places a trade once a day after the new day candle opens. But sometimes I get the warning "Trade Failure, Market Closed".
How do i re-send the trade if it doesn't open?
 
hi, try to know the timezone and what time exactly your broker operates. then modify  your program accordingly. 
 
Joel Protusada:
hi, try to know the timezone and what time exactly your broker operates. then modify  your program accordingly. 
Smart, thanks
 

Most/all brokers close for several minutes at the start of a new day for swap calculation.

Modify your EA. If the order fails, reset your new bar test and wait for the next tick.