Minimize prev_calculated zero resets in MQL4

 

I've noticed that prev_calculated often resets to zero, resulting in unnecessary recalculations of the entire dataset.

I'm looking for a way to minimize the frequency of these resets.

Could this issue be related to the 'Max bars in chart' settings?


Thank you for your help and advice!

 
Sajiro- Yoshizaki: I've noticed that prev_calculated often resets to zero, resulting in unnecessary recalculations of the entire dataset. I'm looking for a way to minimize the frequency of these resets. Could this issue be related to the 'Max bars in chart' settings? Thank you for your help and advice!
If it resets it means the the underlaying rates data has changed (not just the most recent bar) and the indicator needs to be recalculated.
 
Thanks for the advice.

I continued testing in my environment and found that prev_calculated would reset about every 90 minutes when running the high load indicator on multiple charts.

At that time, rate_total would decrease for charts that exceeded the "Max bars in chart" limit, and then for newly added buffers that were not initialized with EMPTY_VALUE.

However, I've found that controlling these resets is extremely challenging. I will look into alternative approaches.

Thanks again for your help.
 
Sajiro- Yoshizaki #:
Thanks for the advice.

I continued testing in my environment and found that prev_calculated would reset about every 90 minutes when running the high load indicator on multiple charts.

At that time, rate_total would decrease for charts that exceeded the "Max bars in chart" limit, and then for newly added buffers that were not initialized with EMPTY_VALUE.

However, I've found that controlling these resets is extremely challenging. I will look into alternative approaches.

Thanks again for your help.
My approach to this problem, where the calculations are very intense and take a long time is:

Use internal arrays for your results. Have a function to manage copying data to the indicator buffers, such that you don't need to recalculate all values.

You can sync the internal buffers with time[]. This way you don't loose the work that has already been done .
 
Dominik Egert #:
My approach to this problem, where the calculations are very intense and take a long time is:

Use internal arrays for your results. Have a function to manage copying data to the indicator buffers, such that you don't need to recalculate all values.

You can sync the internal buffers with time[]. This way you don't loose the work that has already been done .

Though it may seem a bit forceful, the solution is incredibly practical and has highlighted the importance of establishing a robust system.

It has been very enlightening for me.

Thank you for your invaluable advice.