Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to define a variable within the strategy wizard?
Collapse
X
-
birdjaguar,
Please see my response in your thread: http://ninjatrader.com/support/forum...31&postcount=4
-
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?
Leave a comment:
-
Hello birdjaguar,
Are you currently using the wizard or manually coding? If you are manually coding can you provide the syntax you are using?
I look forward to being of further assistance.
Leave a 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
Leave a 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.
Leave a comment:
-
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.
Leave a comment:
-
Ok, I have succeeded in generating the following code:
if (Close[1] >= Open[1]
&& Close[2] >= Open[2]
&& Variable0 == true)
However i cannot figure out how to make Variable0 boolian.
PLEASE ADVISE & THANKS
Leave a comment:
-
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.
Leave a comment:
-
How to define a variable within the strategy wizard?
How can i define a variable for my own use when creating the strategy with the Strategy Wizard?Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by kujista, 04-25-2023, 02:22 AM
|
5 responses
67 views
0 likes
|
Last Post
![]()
by bltdavid
Today, 09:33 PM
|
||
Started by KaizenNU, Today, 06:28 PM
|
0 responses
9 views
0 likes
|
Last Post
![]()
by KaizenNU
Today, 06:28 PM
|
||
Started by bertochi, Today, 05:25 PM
|
0 responses
15 views
0 likes
|
Last Post
![]()
by bertochi
Today, 05:25 PM
|
||
Started by ntbone, 02-12-2025, 01:51 AM
|
4 responses
27 views
0 likes
|
Last Post
![]()
by ntbone
Today, 04:59 PM
|
||
Started by XanderT, Today, 03:38 PM
|
4 responses
13 views
0 likes
|
Last Post
![]()
by XanderT
Today, 04:36 PM
|
Leave a comment: