The effect of disconnection on output of time series functions

 

My EA is sensitive to the information of some recent candlesticks of M1 timeframe. If the internet connection stops for a few minutes, how do I make sure that the functions used (iTime, CopyClose ,...) give the correct values?

How can I know that the output values of these functions are correct after reconnecting?



 
Overweight:

My EA is sensitive to the information of some recent candlesticks of M1 timeframe. If the internet connection stops for a few minutes, how do I make sure that the functions used (iTime, CopyClose ,...) give the correct values?

How can I know that the output values of these functions are correct after reconnecting?



Check the time of the candle compared to current tick time.
 
Alain Verleyen:
Check the time of the candle compared to current tick time.

I think TimeCurrent() return last tick time but iTime() return open time of candle. Is their comparison correct? They are two different things.

In the usual case, they are only equal when new bar is happen.

 
Overweight:

I think TimeCurrent() return last tick time but iTime() return open time of candle. Is their comparison correct? They are two different things.

In the usual case, they are only equal when new bar is happen.

I never said they should be equal. I thought the solution was obvious so I didn't explain, let's do it :

When your code run, you have a current time, if you request OHLC data you just have to check if the current time is inside the bar 0 (using iTime or CopyTime), if not, that means the data you got (using CopyClose or whatever) are not updated yet. If you get old data, bar 0 will be in the past not current open candle.