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
Parameters
Collapse
X
-
Parameters
Hey guys how do I turn my variables into parameters so that they can be optimized in the optimizer?Tags: None
-
elitetradernyw,
There is a section of code near the bottom of each indicator / strategy. It is in the Properties section. This needs to be added.
Code:[Description("Slow period for a moving average")] [GridCategory("Parameters")] public int SlowPeriod { get { return slowPeriod; } set { slowPeriod = Math.Max(1, value); } }
Adam P.NinjaTrader Customer Service
-
Thanks, but when I add the variables and the code here, and I try to compile it gives me an error message, that I may have recursive properties that may cause ninjatrader to crash, how do I avoid this message?
Comment
-
Hello,
Could you please post a sample .cs file that is generating this issue?
Strategies are located in: (My)Documents\NinjaTrader 7\bin\Custom\Strategy
Additionally, please follow the instructions below to see where the errors are coming from after compiling the indicator. This will allow you to debug the indicator/strategy or remove it from your PC. If you are wondering why you receive an error when compiling only one indicator, it is because NinjaTrader always compiles all indicators and strategies - not just one. This is done to give you the highest runtime performance possible.
- Open NinjaTrader
- From the Control Center select the Tools menu--> select the Edit NinjaScript menu item--> select Indicator
- Select any indicator and double click on it (we need only to open and compile one script to see all compile errors for all files).
- A new window will appear and you will need to right click in the window and select Compile to compile the indicators.
- At the bottom of the window a new section will appear where you can find the error locations.
- From there you have the option to comment out offending code sections, remove the complete indicator or debug it to be able to compile again.
If you are unsure as to what the error is indicating, please send me a screenshot of the error with the name and description fields clearly readable.
To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CRTL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
We have also collected more comprehensive steps for resolving NinjaScript programming errors in this tip on our forums - http://www.ninjatrader.com/support/f...ead.php?t=4678LanceNinjaTrader Customer Service
Comment
-
Lance, let me tell you what I'm doing and maybe you can help me from here. I simply add a new variable like:
private int slowAverage = 35; // This one already works.
private int MediumMarketEMA = 4; // This is a new one that does not work -Note not used in code.
Here is the code I add for the new one, that tells me i have a recursive problem:
[Description("MediumMarketEMA")]
[GridCategory("Parameters")]
public int MediumMarketEMA
{
get { return MediumMarketEMA; }
set { MediumMarketEMA = Math.Max(1, value); }
}
Here is error message:
your strategy likely holds one
or more recurisve properties which
could cause NinjaTrader to crash MediumMarketEMA
Do you want to edit these properties?
Any ideas?
Comment
-
Hello,
Please change to the following capitalization within your code:
Code://Variable name [B]mediumMarketEMA [/B]= 4; [Description("MediumMarketEMA")] [GridCategory("Parameters")] public int MediumMarketEMA { get { return [B]mediumMarketEMA[/B]; } set { [B]mediumMarketEMA [/B]= Math.Max(1, value); } }
LanceNinjaTrader Customer Service
Comment
-
Hi Lance, unfortunately the error is still there with lower case caps. I even tried restarting my computer to see if the error would clear up. Any other ideas?
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by algospoke, Yesterday, 06:40 PM
|
2 responses
23 views
0 likes
|
Last Post
by algospoke
Today, 07:04 PM
|
||
Started by ghoul, Today, 06:02 PM
|
3 responses
14 views
0 likes
|
Last Post Today, 06:43 PM | ||
Started by jeronymite, 04-12-2024, 04:26 PM
|
3 responses
45 views
0 likes
|
Last Post
by jeronymite
Yesterday, 10:10 PM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
7 responses
22 views
0 likes
|
Last Post Today, 06:16 PM | ||
Started by AttiM, 02-14-2024, 05:20 PM
|
10 responses
181 views
0 likes
|
Last Post
by jeronymite
Today, 06:11 PM
|
Comment