I'm trying to modify the "swing" indicator, but first I'm trying to make sense of the script's logic. For the most part I already understand how the code works, but on line 93 there is an if statement:
if (BarsArray[0].BarsType.IsRemoveLastBarSupported && CurrentBar < saveCurrentBar)
I don't understand in which scenario is this if statement true or false and what is the purpose of this if statement?
Please explain what is "BarsArray[0].BarsType.IsRemoveLastBarSupported" checking for and how can "CurrentBar < saveCurrentBar" be true at all? Since current bar starts counting from 0 and only goes higher and in the beginning saveCurrentBar is -1 and it's value only changes on lines 109 and 212 when its set equal to CurrentBar. There doesn't seem to be any logical scenario where CurrentBar can be lower than saveCurrentBar.
Comment