How to set limit for max bars in history and max bars in chars?

 


Dear  Friends~

I want to put some code in the indicator about setting limit for max bars in history and max bars in chars,

Preventing  too much data loading on the chart  make CPU slow down or terminal freeze.

Even if some one set the value as 999999999999,the indicator will  optimize value to limit as ex.=>500000.

Would someone please give me some instruction?? Thanks very much!!

 
  1. No need for code. No need to limit max bars in history. Disk space is cheap, and you might want it in optimizer. Max bars in chart is at tools -> options > chart in MT4.
  2. If that still doesn't solve it, then have the indicator do its calculations in groups. See How to do your lookbacks correctly.
 
whroeder1:
  1. No need for code. No need to limit max bars in history. Disk space is cheap, and you might want it in optimizer. Max bars in chart is at tools -> options > chart in MT4.
  2. If that still doesn't solve it, then have the indicator do its calculations in groups. See How to do your lookbacks correctly.

In real time data loading, my indicator recalculates while changing time frame. 
I want to prevent someone set too high value in tools->options that cause terminal freeze.
but need to access new bars data.
I need a code to control max bars in chart and history, Is there any other ways?

Thanks!! 



Reason: