Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to define a variable within the strategy wizard?
Collapse
X
-
Hello,
The variables in the wizard are known by User Variable. To set these, in a Set click Add to add a "Do the following".
Select Misc -> set user defined variable.
Select a variable from the drop down list, and for the value you can type in a number, or use the (...) button on the right to select a data value.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
joemiller,
Variable0 through Variable9 are all special variables created by NinjaTrader mostly for use with the Strategy Wizard.
It is not possible in C# to change a Variables type after it has been declared.
These variables are created by the core of NinjaTrader and are created as doubles. They cannot be changed to bool.
But you can use them like a bool. If you set the value to 0 that can mean false and if you set the value to 1 that can mean true.
Code:if (Variable0 == 1) { // the value is 1 so use this as true } else if (Variable0 == 0) { // the value is 0 so use this as false }
Instead, if you need a bool, I would recommend you just create bool. If you are using the Strategy Wizard you can make a public bool input on the User Defined Inputs page.Chelsea B.NinjaTrader Customer Service
Comment
-
Since this seems to be a newbie thread, I have a similar request. I am trying to link certain variables to only one variable so that it will optimize only on one variable such as a SMA. For example, I would like to link a RSI to the SMA. So, whatever value is entered for the SMA, the RSI would be some fraction of that. Rather than using a hard number for RSI, I want it to be SMA*.25. It seems so simple, but I am not able to get it to work without errors in the code. With this approach, when I change the SMA, the RSI will remain proportional to the SMA. Please advise.
Comment
-
Originally posted by birdjaguar View PostSince this seems to be a newbie thread, I have a similar request. I am trying to link certain variables to only one variable so that it will optimize only on one variable such as a SMA. For example, I would like to link a RSI to the SMA. So, whatever value is entered for the SMA, the RSI would be some fraction of that. Rather than using a hard number for RSI, I want it to be SMA*.25. It seems so simple, but I am not able to get it to work without errors in the code. With this approach, when I change the SMA, the RSI will remain proportional to the SMA. Please advise.
sorry, not knowledgeable enough to help you.
However, in case you have upgraded to NT8, i did just learn that
''Variable0 does not exist in NinjaTrader 8. (You can create your own private variables now)''
joemiller
Comment
-
I use the wizard to see how things are coded and then do it manually. This is not an option, however, for what I am trying to accomplish. Therefore, I have no code for it. To illustrate, let me just show you how I do this in EasyLanguage.
inputs: Price( Close ), SMAlength( 100 ) ;
variables:
MySMA (0), MyRSI( 0 );
MySMA = Average( Price, SMAlength);
MyRSI = RSI( Price, SMAlength*.25 );
So, do I need to set my RSI in the initialize section and also in the properties? Will this enable me to set it to the SMA period *.25?
Comment
-
birdjaguar,
Please see my response in your thread: http://ninjatrader.com/support/forum...31&postcount=4
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by helpwanted, Today, 03:06 AM
|
1 response
14 views
0 likes
|
Last Post Today, 03:35 AM | ||
Started by Brevo, Today, 01:45 AM
|
0 responses
11 views
0 likes
|
Last Post
by Brevo
Today, 01:45 AM
|
||
Started by aussugardefender, Today, 01:07 AM
|
0 responses
6 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
244 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
387 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
Comment