mt5 history refresh and jump back problem

 

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 ! 

 

Files:
 
  • Max. bars in chart— there is a difference between the bars stored in history and those shown in charts. This difference is determined by the fact that any amount of bars can be kept in the hard disk provided that it has enough space. But the amount of bars shown in the chart is limited by the computer resources.
     
    Bars displayed on the chart are used for drawingtechnicalandcustomindicators. When multiple indicators and large amount of data to be displayed are used simultaneously, computer free resources (CPU load and free RAM) can exhaust very soon.
     
    To avoid such problems, you can set the amount of data displayed on the charts. This can be done by selecting a corresponding value from the pop-up list or by entering a value manually in this field (minimum value is 5000). For the changes of this parameter to take effect, restart the platform.

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.

 
Farzin Sadeghi:

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 ! 

 

It's expected behavior, what is the problem ?
 
Alain Verleyen:
It's expected behavior, what is the problem ?

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[5071] instead of high[6051] in above logs. and ruins the drawn zigzag pattern.

look at the drawn trendline from that candle to the reduced bar number. 

 
Farzin Sadeghi:

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[5071] instead of high[6051] in above logs. and ruins the drawn zigzag pattern.

look at the drawn trendline from that candle to the reduced bar number. 


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.

 
Alain Verleyen:

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:| 

Documentation on MQL5: Custom Indicators
Documentation on MQL5: Custom Indicators
  • www.mql5.com
Custom Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: