As far as I can rememebr. Nothing get shifted around. Think of arrys as drawers. In every drawer there is a number. the Arry[x] where x = the number of drawers. U must tell the EA where to put the numbers. If U want to move everything up, U have to do it. It does not happen by it's self.
If U say arry[4]=10, then arry 0-3 will be emty.
Usualy U use a for statement to fill up arrays. Search the form and U will find plenty examples.
Also rememebr if U assign arry[101] and there is only 100 set in the variable U will get an error. Is like putting a nuber in a drawer that does not exist.
Somewhere where U might get confused is the bars/ibars. There bars[0] is always the latest price. bars[1] is the previos bars price etc. There the "arry" get moves up yes.
Hope this helps.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
When using buffers and/or arrays, does the complete buffer/array shift by 1 index up at the beginning of a new bar?
Example: assume there's 100 bars in the graph and I have an indicator buffer (double test_ind[]) and an array (double test_arr[1000]).
During one bar on a 100 bar graph test_ind[99] is the most left bar, test_ind[0] is the current bar and test_arr[99] is the most left bar and test_arr[0] is the current bar.
When a new bar starts, does everything shift so test_ind[99] does not exist anymore but is now the value that used to be in test_ind[98], and similar test_ind[0], the previous current bar is now test_ind[1]?
And what about the array. It has a dimension of 1000 but I'm only using 100 because of the number of bar in the graph being 100. Does that one get shifted too?
Any advise is welcome.
Yves