Hi , I have limited my MT5 to 5000 candles. now there are more candles available on the chart than this limit . and at random times the whole chart refreshes and counter bars goes back.
please see the attached pic and tell me if there is a solution to this jump backs ?
2016.12.12 19:00:01.539 Far-Elliott oscillator-waves1 (EURUSD,M1) 404-u=6049 | prev_calculated=6049 | Bars(_Symbol,_Period)=6050
2016.12.12 19:00:01.778 Far-Elliott oscillator-waves1 (EURUSD,M15) 404-u=5070 | prev_calculated=5070 | Bars(_Symbol,_Period)=5071
2016.12.12 19:01:02.124 Far-Elliott oscillator-waves1 (EURUSD,M1) 404-u=6050 | prev_calculated=6050 | Bars(_Symbol,_Period)=6051
I have a code in my deInit to view reload reason but in this case the indicator does not run deInit. just PrevCalculated goes back and then continues !
Indicators can access more bars than specified in "Max bars in chart" parameter for more efficient calculation. Older bars are not removed immediately from the data cache when the new ones appear. This allows not to recalculate an indicator at each new bar, but calculate its values for new bars instead.
Changes of the settings take effect after clicking the OK button except the "Max. bars in chart" option. Restart the platform after you change the parameter.
The problem is that I am checking for high/low of last candle to draw trend line. when this candle number reduces the indicator draws a line to that high instead of high in above logs. and ruins the drawn zigzag pattern.
look at the drawn trendline from that candle to the reduced bar number.
MetaTrader Trading Platform Screenshots
EURUSD, M1, 2016.12.12
RoboTrade Ltd, MetaTrader 5, Demo
So the problem is in your code, you will have to fix it.
Your code need to take into account how the platform is working, not the reverse.
at this link they didn't say that prev_calculated will jump back https://www.mql5.com/en/docs/customind
I haven't seen such a thing happen in mt4. anyways I will add a condition if the target was greater than start then draw the line. in mt5 we should overthink of every thing:|