My goal is to have buttons on my strategy that enable the bot to trade longs or short if the button is in the on/off positions. Essentially an on/off button to allow longs, and another for shorts. Right now I have a button on the strategy that changes a private bool Use_Long from true to false. I have another button that changes Use_Short. Then in my if statement conditions for entry, I have && (Use_Long = true). Mind you, all my other conditions in that if statement are respected. I can't figure out why these aren't. I have a print window that displays the state of Use_Long on bar update, and the buttons are working perfect and changing the variable in the print window as expected. But even when Use_Long is false, it still takes the entry. Any thoughts?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Using active buttons to control variables on my strategy while its running
Collapse
X
-
Using active buttons to control variables on my strategy while its running
Hello,
My goal is to have buttons on my strategy that enable the bot to trade longs or short if the button is in the on/off positions. Essentially an on/off button to allow longs, and another for shorts. Right now I have a button on the strategy that changes a private bool Use_Long from true to false. I have another button that changes Use_Short. Then in my if statement conditions for entry, I have && (Use_Long = true). Mind you, all my other conditions in that if statement are respected. I can't figure out why these aren't. I have a print window that displays the state of Use_Long on bar update, and the buttons are working perfect and changing the variable in the print window as expected. But even when Use_Long is false, it still takes the entry. Any thoughts?
Tags: None
-
I forgot to put two equal signs.... 0_0
if anyone was wondering how I did it, the code from this link was really helpful:
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
88 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
135 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
68 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
119 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
69 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment