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 Stanfillirenfro, Today, 05:19 AM
|
4 responses
13 views
0 likes
|
Last Post Today, 02:55 PM | ||
Started by lorien, 01-15-2025, 12:10 PM
|
10 responses
106 views
2 likes
|
Last Post
by lorien
Today, 02:45 PM
|
||
Started by Touch-Ups, Yesterday, 08:42 AM
|
6 responses
35 views
0 likes
|
Last Post
by Touch-Ups
Today, 02:44 PM
|
||
Started by levk0malyna, Today, 01:30 PM
|
3 responses
10 views
0 likes
|
Last Post Today, 02:03 PM | ||
Started by zagier, 01-15-2025, 05:10 AM
|
9 responses
44 views
1 like
|
Last Post
by burmaz
Today, 01:53 PM
|
Comment