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
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
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 sdauteuil, 09-23-2021, 10:16 AM
|
7 responses
1,247 views
0 likes
|
Last Post
by marcus2300
Today, 01:28 AM
|
||
Started by sofortune, 05-18-2024, 11:48 AM
|
2 responses
32 views
0 likes
|
Last Post Yesterday, 07:11 PM | ||
Started by Zach55, 02-19-2024, 07:22 PM
|
2 responses
66 views
0 likes
|
Last Post
by lbadisa1
Yesterday, 07:06 PM
|
||
Started by JGriff5646, Yesterday, 05:47 PM
|
1 response
14 views
0 likes
|
Last Post Yesterday, 06:45 PM | ||
Started by AlphaOptions, 06-18-2013, 08:24 AM
|
9 responses
2,203 views
0 likes
|
Last Post Yesterday, 06:36 PM |
Comment