Pembroke Pines
Experience: Beginner
Platform: NinjaTrader
Broker: Ninjatrader
Trading: Futures
Frequency: Daily
Duration: Minutes
Posts: 26 since Nov 2022
Thanks Given: 0
Thanks Received: 2
|
Hello ABCTG
In the code you provided, the variables var0 and var1 are declared as local variables within the scope of the function. Local variables are created and initialized each time the function is called, and their values are not retained between function calls.
In this specific code snippet, var0 is used to track the highest value of High encountered so far, and var1 is used to track the lowest value of Low encountered so far. As the function is called on each bar, these variables are updated based on the current High and Low values.
When the function is called again on the next bar, the variables var0 and var1 will be reinitialized to zero, and the process of tracking the highest High and lowest Low values will start anew.
So, in summary, the values of var0 and var1 do not persist between function calls. They are local variables that are reinitialized each time the function is executed.Hope this answers you question. Take Care!
|