I closed the strategy analyzer and then opened a new one and it worked properly.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Bug with optimizer when changing parameter type
Collapse
X
-
Bug with optimizer when changing parameter type
I changed one of my strategy parameters from int to double and then ran the strategy optimizer. For example I ran from 2;4;0.5 (2-4 stepping by 0.5). The results had the same values for 2 & 2.5, and the same for 3 & 3.5. It look me a while to figure it out but what was happening was the optimizer was using int instead of double.
I closed the strategy analyzer and then opened a new one and it worked properly.Tags: None
-
Originally posted by NinjaTrader_Josh View PostYou were likely just still running on the old instance of your strategy with it being an int before.
I just thought I'd post it here in case you want to look into and/or if someone else notices weird behavior this could explain it. It took me a while to figure it out.
Comment
-
I have a similar problem... when changing a variable and backtest/optimize the parameter doesn't "save". I have a large formula with about 20 variables.
I've tried shutting the Strategy Analyzer (SA) down and starting it back up again and the values are still set as they were before the SA was closed. Changing them has no effect.
Even when I shut ninja trader down and start it back up I'm not be able to change the values. I have to go into the code, into the Variables and Properties to change the default values to be able to use them.
What may be the problem?
Comment
-
Originally posted by pureporsche View PostI have a similar problem... when changing a variable and backtest/optimize the parameter doesn't "save". I have a large formula with about 20 variables.
I've tried shutting the Strategy Analyzer (SA) down and starting it back up again and the values are still set as they were before the SA was closed. Changing them has no effect.
Even when I shut ninja trader down and start it back up I'm not be able to change the values. I have to go into the code, into the Variables and Properties to change the default values to be able to use them.
What may be the problem?
There's something that I consider weird going on but apparently it's as designed. When you run a backtest or the optimizer, Ninjatrader will initialize your strategy more than once. I found this out because I print out the instrument name in my strategy. So let's say I run backtest on ES, I see my strategy print out both ES & QM. I have no idea why QM!
Could this be related?
Comment
-
Initialize() is called at several points in time. You will get several prints.
As far as "saving" values go, the optimizer doesn't "save" parameter values. You have to change it away from what you coded as the default if this is something you wanted to do.
A 1;1;1 optimize doesn't optimize anything. This is why you may not see anything.Josh P.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Josh View PostInitialize() is called at several points in time. You will get several prints.
As far as "saving" values go, the optimizer doesn't "save" parameter values. You have to change it away from what you coded as the default if this is something you wanted to do.
A 1;1;1 optimize doesn't optimize anything. This is why you may not see anything.
Comment
-
Originally posted by NinjaTrader_Josh View PostIf you run the optimizer on 1;1;1 it won't do anything. There is nothing to optimize.
like:
smaPeriod 10;20;5
optimize 1;1;1
if optimize = 1 it'll use the parameter values
if optimize = 0 it'll ignore the parameter values and use my hardcoded values
The reason I do this is because when I run live I want to be 100% sure I use the right parameters. So I hardcode them in the code.
Comment
-
Originally posted by NinjaTrader_Josh View PostThen I am not sure what your concern is about.
if(optimize==0) {
smaPeriod = myHardcodedSmaPeriod;
}
And sometimes when I put optimize=1, it still uses my hardcoded value. So I run backtest with optimize=1 and then rerun the optimizer (not changing anything) and then it works properly. The fact that initialize is invoked several times may have something to do with it, I'm not sure..
Comment
-
Yes this is a similar issue I'm having.
When I say "save" I mean it doesn't hold the new new values when running the operation. It seems to be very erratic and hard to replicate - would be nice to give you a scenario.
I have double varA = -99.5 for instance in the code and then I change it (either in optimize or backtest) to -100 (I have 20 or so variables). When running it the value it uses is still -99.5.
If I close the strategy analyzer and reopen it, it makes no difference. I have to go into the code and change it.
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