Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
bool variable keeps changing
Collapse
X
-
bool variable keeps changing
So i have a bool variable called, "EnableLong". It's set as true under State.SetDefaults. i havent had any issues with it until today. For some reason, it keeps changing to False when i run my custom strategy. I've commented out all instances of "EnableLong = false;" Yet it still changes to false. Is that even possible?Tags: None
-
Hello only_nq,
Welcome to the NinjaTrader forums!
If it's been set to false at any time it will remain false.
State.SetDefaults runs for the new instance of the script and never again.
If you want to reset this to true each time you run the script, set this to true in State.DataLoaded, which runs each time the script is enabled.
Chelsea B.NinjaTrader Customer Service
-
thanks for the suggestion. It turns out, i had a statement: "else if (EnableLong = true .... " with one equal sign, and compile didnt catch that? So i guess that's where EnableLong was changed to false. i thought that's not possible inside if else structure...
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by pibrew, Today, 06:37 AM
|
0 responses
1 view
0 likes
|
Last Post
by pibrew
Today, 06:37 AM
|
||
Started by rbeckmann05, Yesterday, 06:48 PM
|
1 response
14 views
0 likes
|
Last Post
by bltdavid
Today, 05:43 AM
|
||
Started by llanqui, Today, 03:53 AM
|
0 responses
6 views
0 likes
|
Last Post
by llanqui
Today, 03:53 AM
|
||
Started by burtoninlondon, Today, 12:38 AM
|
0 responses
11 views
0 likes
|
Last Post Today, 12:38 AM | ||
Started by AaronKoRn, Yesterday, 09:49 PM
|
0 responses
15 views
0 likes
|
Last Post
by AaronKoRn
Yesterday, 09:49 PM
|
Comment