Download MetaTrader 5

Static Buffer on LimitBars Chart

To add comments, please log in or register
rofranco
68
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

Mladen Rakic
67875
Mladen Rakic  
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
nicholishen
1389
nicholishen  
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.

To add comments, please log in or register