how to check new bar when EA running on offline chart?

 

If EA is running on normal chart, I can use 

below code to check whether it is a new bar or not. However it does not work when EA is running on offline chart. Anyone know how to check new bar on offline chart?

   static datetime tLast = 0;
  if ( tLast == Time[0] )

  return;
   tLast = Time[0];
 
As I know it is not ok to offline run the EA. In order to run the EA during offline, you may subscribe a offline serve with metatrader
 
xlitang:

If EA is running on normal chart, I can use 

below code to check whether it is a new bar or not. However it does not work when EA is running on offline chart. Anyone know how to check new bar on offline chart?

If you are providing ticks to your offline chart you can use exactly the same code.
 
RaptorUK:
If you are providing ticks to your offline chart you can use exactly the same code.


not sure how to providing ticks to offline chart? Can you explain please?
 
You must have the offline chart generator RUNNING on a chart to get ticks.
 
WHRoeder:
You must have the offline chart generator RUNNING on a chart to get ticks.

I do. The offline chart is constantly updated.
 
xlitang:

I do. The offline chart is constantly updated.
Your code will work in that situation.
Reason: