MT4 drawing error when candles are deleted - page 3

 
Vladislav Boyko #:

Limit 50000 bars. For almost 3 hours of the indicator's operation on the M1 timeframe, the terminal did not delete anything. I can't reproduce the situation you described where the terminal deletes bars.

The indicator I ran (your indicator + logging):

Thats because the terminal has a minimum amount of bars it allows for buffers. Once surpassed, the terminal will truncate the buffers.

It will shorten the end of the array and refill the remaining with the current data, cutting off history data. (OHLC data buffers)

Now prev_calculated is set to zero and you need to handle your buffers. - Either also copy/shift your buffers values and recalculate any missing bar-sections, or just recalculate all buffers.

But dont forget to fully initialize your buffers, because the size, but not the content is managed by the terminal.
 
Dominik Egert #:
Thats because the terminal has a minimum amount of bars it allows for buffers. Once surpassed, the terminal will truncate the buffers.

It will shorten the end of the array and refill the remaining with the current data, cutting off history data. (OHLC data buffers)

Now prev_calculated is set to zero and you need to handle your buffers. - Either also copy/shift your buffers values and recalculate any missing bar-sections, or just recalculate all buffers.

But dont forget to fully initialize your buffers, because the size, but not the content is managed by the terminal.

Hi, so if I understand correctly, after truncating the array, the values stored at the previously given indices are shifted to new candles and don’t get a default empty value like they do when a new candle is added.

Thus, if I don’t set the values of all watched indices in the buffers to empty value during each run, these non-cleared values will shift after a deletion.

I’m just curious: if this is indeed the case, what does this have to do with the predefined arrays(https://docs.mql4.com/predefined) that other moderators previously referred to in response to my original question?

Predefined Variables - MQL4 Reference
Predefined Variables - MQL4 Reference
  • docs.mql4.com
Predefined Variables - MQL4 Reference
 
Laszlo Csipkes #:

Hi, so if I understand correctly, after truncating the array, the values stored at the previously given indices are shifted to new candles and don’t get a default empty value like they do when a new candle is added.

Thus, if I don’t set the values of all watched indices in the buffers to empty value during each run, these non-cleared values will shift after a deletion.

I’m just curious: if this is indeed the case, what does this have to do with the predefined arrays(https://docs.mql4.com/predefined) that other moderators previously referred to in response to my original question?

If you can reproduce the situation in which the terminal remove bars from the chart, then please run that indicator and attach the logs from the experts tab here.

This will allow us to find out what happens to the arrays at the moment of deleting bars from the chart and whether the prev_calculated variable is reset.