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 NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
58 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
133 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
73 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|

Comment