Why the difference between Bars[Bars.Count -1].Low and Bars.LowPrices.Last(1)
Why the difference between Bars[Bars.Count -1].Low and Bars.LowPrices.Last(1)
13 Feb 2023, 13:28
Hi all,
Could someone please explain why Bars[Bars.Count - 1].High references the currently forming bar? ie:- it's the same as Bars.HighPrices.Last(0).
I was expecting [Bars.Count -1] to be the same as Last(1), But I need to make it [Bars.Count - 2] to retrieve the same info as Last(1).
Just to be clear...
Bars[Bars.Count - 1].Low == Bars.LowPrices.Last(0)
Bars[Bars.Count - 2].Low == Bars.LowPrices.Last(1)
Bars[Bars.Count].Low == 'Specified argument was out of the range of valid values. (Parameter 'index')'
I know this is prolly by design... just looking to understand 'why is it so' :)
Replies
drewisdad
13 Feb 2023, 16:34
RE:
PanagiotisChar said:
Hi there,
Counting C# starts from 0. So Bars[0] is the first bar and Bars[Bars.Count - 1] is the last bar.
Need help? Join us on Telegram
Need premium support? Trade with us
Ahhh gotcha :) Thank you kindly :) So Bars.Count will always be 1 bar in the future that we'll never get to see.
I'm heading off to re-factor all my bots now... Maybe I Do have something that could work after all LOL :)
Thanks again for clarifying :)
@drewisdad
PanagiotisChar
13 Feb 2023, 15:18
Hi there,
Counting C# starts from 0. So Bars[0] is the first bar and Bars[Bars.Count - 1] is the last bar.
Aieden Technologies
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar