I have an indicator, which works with an array (not candle's data, but on-the-fly generated). This array is empty at the first starting.
When the indicator runs, this array gets new values.
My problem: when I change an input parameter and refresh the indicator on the chart, my array will be empty and starts to collect data from beginning.
Is it possible somehow to preserve the existing array-data?
(This is not problem for an expert, but problem for an indicator, because when refreshing it takes into account the initial values outside the OnInit() and frees the array.)
This is normal.
You can transfer an array from an old copy of the indicator to a new one.
Thank you. Your solution is a bit circumstantial.
Is there any simpler solution (without those include files) or is it the one and only?
fxsaber solution is only valid for mql5. In mql4 you could save your array data to a file and re-load it at every new initialization. Regards.
fxsaber solution is only valid for mql5.
An array can also be passed through resources and global variables.
Yes, in mql4 you can use resources and global variables, but in your code, you use several functions (ChartIndicatorGet(), IndicatorParameters(), IndicatorRelease(), etc) and structures (MqlParam) that don't work in mql4.