The current bar is at index [ 0 ] and the oldest bar is at [ Bars - 1 ]. If you count from [ 0 ] to [ Bars - 1 ] , there will be a total of Bars.
The current bar is at index [ 0 ] and the oldest bar is at [ Bars - 1 ]. If you count from [ 0 ] to [ Bars - 1 ] , there will be a total of Bars.
ah, sorry I mean, in the example case I mentioned 65029 is the current total number of Bars,
but you are right, I was wrong trying to use the number of bars for the array elements, it has to be an index , I was also wrong in saying that Close[65029] will return a value, this also won't work if 65029 is the total bars.
so to get the last Close bar price (old bar) we have to use the last index, namely Bars-1, so it has to be Close[Bar-1], thank you sir
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
if I get the current Bar number for example 65029, then Close[65029] will return the value, but if directly use the Close[Bars] statement at that time, it will generate an "array out of range" warning, except the line "#property strict" is not written in script,
is there any explanation for this?
sorry if this has already been discussed, please give me a link to the topic so I will go there and read it, thanks for the response.