Manage per tick execution and use of market data efficiently

 

Hi,

I'm writing an EA that will mostly use daily updating signals (i.e. market data is PERIOD_D1) but the EA will then select an appropriate time intra-day to trade (i.e. will need to make a per tick decision, until the trade is made)

There is clearly no need to update the daily signals and daily market data at every tick, but does anyone have any advice how best to structure this?

I am using the Time Series classes, e.g. CiOpen initialized to PERIOD_D1, and then call Refresh() function to update the data.

I have a feeling calling Refresh() every tick event is going to be very inefficient or does anyone know if the Refresh function has efficient logic built into it to manage this situation?

If not, then has anyone got a recommendation how to do this efficiently?

E.g. a primitive way to do this is: after the signal executes on some new daily data, I could store the time in a global, and then check at each tick event to see if over a day has elapsed before calling the Refresh function.

However, simultaneously of the market data I use will be difference time frames, e.g. PERIOD_H1, so I need the logic to be flexible to only update particular data at the appropriate intervals. Again I'm hoping the Refresh function is handling all this!

Thanks.

Reason: