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 jackiegils, Today, 11:05 PM
|
0 responses
5 views
0 likes
|
Last Post
by jackiegils
Today, 11:05 PM
|
||
Started by cre8able, Yesterday, 09:15 PM
|
2 responses
17 views
0 likes
|
Last Post
by cre8able
Today, 10:36 PM
|
||
Started by Trader146, Today, 09:17 PM
|
0 responses
9 views
0 likes
|
Last Post
by Trader146
Today, 09:17 PM
|
||
Started by ttrader23, 05-08-2024, 09:04 AM
|
9 responses
43 views
0 likes
|
Last Post
by ttrader23
Today, 08:29 PM
|
||
Started by ZeroKuhl, Yesterday, 04:31 PM
|
8 responses
46 views
0 likes
|
Last Post
by ZeroKuhl
Today, 07:25 PM
|
Comment