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 warpinator, 05-16-2024, 10:44 AM
|
11 responses
60 views
0 likes
|
Last Post
by ETFVoyageur
Today, 01:54 PM
|
||
Started by ETFVoyageur, Today, 10:34 AM
|
7 responses
20 views
0 likes
|
Last Post Today, 01:50 PM | ||
Started by KNalley, 01-24-2020, 10:33 AM
|
10 responses
965 views
0 likes
|
Last Post Today, 01:49 PM | ||
Started by Skifree, Today, 11:47 AM
|
3 responses
13 views
0 likes
|
Last Post
by Skifree
Today, 01:49 PM
|
||
Started by molecool, Today, 01:48 PM
|
0 responses
4 views
0 likes
|
Last Post
by molecool
Today, 01:48 PM
|
Comment