The region of code where a variable or function is accessible. For instance, a variable defined inside a function (local scope) is not visible outside it, whereas a global variable (declared outside) is accessible throughout the EA. Understanding scope ensures that values and state are not unintentionally shared or hidden. For example, using a global double LotSize
means any function can read/write it, whereas a local variable in OnTick()
would be reset on each tick.