Static Buffer on LimitBars Chart

 

Hi, when we limit the number of bars in the chart, the Buffer stays static, with a new bar the value of array [0] not turn array[1] and is overwritten.

Is there a simple way to inhibit this, or is necessary to transpose the array using ArrayCopy or copy one value by one value?

Thanks

 
rofranco:

Hi, when we limit the number of bars in the chart, the Buffer stays static, with a new bar the value of array [0] not turn array[1] and is overwritten.

Is there a simple way to inhibit this, or is necessary to transpose the array using ArrayCopy or copy one value by one value?

Thanks

It does not stay static if it is declared as a buffer
 
rofranco:

Hi, when we limit the number of bars in the chart, the Buffer stays static, with a new bar the value of array [0] not turn array[1] and is overwritten.

Is there a simple way to inhibit this, or is necessary to transpose the array using ArrayCopy or copy one value by one value?

Thanks


The easiest way to make this work is with reverse indexing so instead of the entire array shifting when a new bar comes in you simple add one element to the end. If you're in MQL4 this means you need to use 

ArraySetAsSeries(array,false);

on all the arrays you'll be working with.

Reason: