I am a programmer and am trying to figure out how to set a "global" flag in my code that does not get updated on every bar. For instance, I am writing code to scale out of a position and I want to set a "flag" once my first target is hit so that I can use an if statement to check for my bool "flag" setting and if it is true (1st target has been hit); I will ignore this exit and the code will continue to check my next exit logic.
In my mind I need to declare this variable outside of the OnBarUpdate section but when I try to do this I get compilation errors (i.e. OnStartUp).
I hope this all makes sense; can someone help me please? I have searched the NT help guide and all over this forum and I can't find anything related to what I'm trying to do. Any ideas?
Thanks.
Comment