The change is apparently enough that my tests against selected enum values is not working during an optimization, even though I can see that the optimizer itself is iterating through the checkbox values. Basically, I think I just need to know how to reference the optimizer checkbox values, but I do not know how to do this. Any help would be greatly appreciated!
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
Testing enums values work as expected in standard backtest, but not in optimization
Collapse
X
-
Testing enums values work as expected in standard backtest, but not in optimization
Hi, I have an enum which I can successfully test the value selected in a standard backtest. However, when I run an optimization things do not work as expect. I am 99% sure this is due to my not knowing how to compensate for the change enum selectors undergo when an optimization is chosen. (this change is visually obvious - for a "Standard" Backtest an enum selector is in form of a dropdown style menu, whereas for an 'Optimization' the selector for an enum automatically changes to checkbox values for each enum option)
The change is apparently enough that my tests against selected enum values is not working during an optimization, even though I can see that the optimizer itself is iterating through the checkbox values. Basically, I think I just need to know how to reference the optimizer checkbox values, but I do not know how to do this. Any help would be greatly appreciated!Tags: None
-
Hello Calebg,
From your code you would not have to do anything different to utilize the optimized value similar to the other properties you made. Can you provide a specific example of what you tried that is not working?
The general process to use an enum would be as follows:
You can use the enum from this indicator sample as a test: https://ninjatrader.com/support/help...ned_parame.htm
The property in a strategy would then look like:
Code:[Display(GroupName = "Parameters", Description="Choose a Moving Average Type."), NinjaScriptProperty] public CustomEnumNamespace.UniversalMovingAverage MAType { get;set; }
Code:protected override void OnStateChange() { else if (State == State.DataLoaded) { Print(MAType); } }
Code:EMA WMA SMA EMA
I look forward to being of further assistance.
JesseNinjaTrader Customer Service
-
Sorry ahead of time for an abbreviated reply, but I decided to punt using enums all together, because for a couple months running I have been running into various hassles around them. For my own personal development I'll probably classify them as 'not the right tool for the job, more often than not' and make every effort to find a different structure to work with. In this case I just replace the enum with a 'standard' manual parameter input box which accepts a certain range of integer values. This makes the code not as readable I guess, but it was instantly worth it just to not have to deal with enums and now everything is working as expected.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Padan, Today, 02:02 AM
|
9 responses
21 views
0 likes
|
Last Post Today, 03:27 PM | ||
Started by spottysallrite, Today, 11:31 AM
|
7 responses
21 views
0 likes
|
Last Post Today, 03:26 PM | ||
Started by nandhumca, Today, 03:15 PM
|
1 response
2 views
0 likes
|
Last Post Today, 03:23 PM | ||
Started by PopovDS, 03-11-2024, 12:49 PM
|
3 responses
17 views
0 likes
|
Last Post
by PopovDS
Today, 03:16 PM
|
||
Started by Lele2k24, Yesterday, 11:24 AM
|
12 responses
37 views
0 likes
|
Last Post Today, 03:07 PM |
Comment