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 dcriador, Today, 12:06 PM
|
0 responses
10 views
0 likes
|
Last Post
by dcriador
Today, 12:06 PM
|
||
Started by dcriador, Today, 12:04 PM
|
0 responses
6 views
0 likes
|
Last Post
by dcriador
Today, 12:04 PM
|
||
Started by cutzpr, Today, 08:54 AM
|
0 responses
11 views
0 likes
|
Last Post
by cutzpr
Today, 08:54 AM
|
||
Started by benmarkal, Today, 08:44 AM
|
0 responses
22 views
0 likes
|
Last Post
by benmarkal
Today, 08:44 AM
|
||
Started by Tin34, Today, 03:30 AM
|
2 responses
29 views
0 likes
|
Last Post
by Tin34
Today, 04:11 AM
|
Comment