Jean
Jean

Reputation: 137

MQL4 max bars in chart

I'm trying to limit resources consumed by MT4 and go to options to set max bars in chart to something smaller like 500. My custom indicator calculates values from a 10 and 20 EMA.

Now the indicator does not even want to attach to the chart!

Even if I increase the number I cannot get my CI to attach to the chart again.

Please can you let me know what the minimum number should be for max bars in chart and why a simple CI as set out above will not attach to the chart?

Lastly, could you please help me also by stating what the default value for max bars in chart normally is? I thought it is 999999 but cannot remember.

Thanks so much for your effort.

Upvotes: 0

Views: 1696

Answers (1)

Daniel Kniaz
Daniel Kniaz

Reputation: 4681

In order to use your resources efficiently, ask your indicator to compute only last bars, prev_calculated should be used and go only since that value to the end of the chart(to the current bar). You can also make your indicator sleeping if number of bars is same, and let it run only when new bar appears (rates_total>prev_calculated) if that can be accepted for your task

Upvotes: 1

Related Questions