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 CarlTrading, 03-31-2026, 09:41 PM
|
1 response
45 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
21 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
31 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
50 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
42 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment