Custom indicator synchronization problem

 

Hi:

I have just met a problem of the custom indicator data buffer synchronization problem.

I made an indicator called ML_iDayATR , which is used in the timeframe smaller than D1. This indicator plot the day ATR value in the chart like H4, H1.

The first run of ML_iDayATR indicator is very slow.

I have another custom indicator called ML_iZigZag which invokes ML_iDayATR. However, as ML_iDayATR is slow at its first run, when I apply ML_iZigZag, the first a few iterations can't get the correct ATR value.

It seems although the ML_iZigZag calls ML_iDayATR, ML_iZigZag won't wait for ML_iDayATR. So ML_iZigZag don't get correct data initially.

Is there any way to solve problem please?

 

Slow indicator - reduce bars on chart, or fix the indicator.

If the indicator is looking at other timeframes it has to handle error 4066. And for indicators that means ArrayCopyRates in init or a repainting.

There is no synch problem. The first indicator is broken.

Reason: