Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Self optimizing strategy
Collapse
X
-
Self optimizing strategy
I want to create a strategy which optimizes itself as it is executing, ie analysis runs in the background and if a more optimal set of parameters is found then the strategy will begin operating with those parameters. The only thing I am stuck on is how to find the optimal parameters. Is there any way to initiate a strategy analysis from within a ninjascript? (either backtest or optimization would work) Or any other suggestions of how to accomplish this? I need to put some of these excess CPU cycles to use
Tags: None
-
Originally posted by sefstrat View PostI want to create a strategy which optimizes itself as it is executing, ie analysis runs in the background and if a more optimal set of parameters is found then the strategy will begin operating with those parameters. The only thing I am stuck on is how to find the optimal parameters. Is there any way to initiate a strategy analysis from within a ninjascript? (either backtest or optimization would work) Or any other suggestions of how to accomplish this? I need to put some of these excess CPU cycles to use
Maybe this would give some ideas http://articles.mql4.com/506, this would be public or just to your use?
Regards
-
Sounds like you want to do a walk-forward optimization. Please take a look at this Help Guide article: http://www.ninjatrader-support.com/H...AStrategy.htmlJosh P.NinjaTrader Customer Service
Comment
-
Thanks for the link, some nice information at that site =) Yes, basically I want to do what they are doing there.. run an optimization (not walk forward) periodically and have my active strategy access the results from that optimization. I can instantiate a new StrategyAnalyzer, but as far as I can see there is no way to invoke analysis from code or access the results of an analysis since the necessary members are not publicly visible. I do see that there are public methods for saving and loading analysis sessions from XmlDocument, so I thought it might be possible to restore a saved session, then update its optimization data and save it to xml which I could then access in my strategy. Is that possible or any other way to accomplish this scenario?Originally posted by PrTester View PostMaybe this would give some ideas http://articles.mql4.com/506, this would be public or just to your use?
Regards
Comment
-
Ninjatrader v.s. Metatrader 4 on this topic
Hello Ninjatraders,
First of all, sorry for bumping this old thread, but it seems the only one which is relevant regarding the automation of a self-optimizing trading model.
As a Metatrader 4 developer/trader I've created a trading model with a self-optimizing engine. Since this feature has not been implemented in MT, I was forced to create this myself. In short, this works as follows.
On specific times, during the day:
- Collect a large array of historical prices, both an initial historic part for the indicator calculations and for the optimization itself.
- Simulate trades for all model parameters in certain steps.
- Evaluate the current fitness (profit, etc) against the last best one.
- Adjust the model parameters.
Technically this is almost running fine in MT4, but it's very hard to simulate those trades with a realistic approach since I can't call historic bid/ask prices, so I have to simulate them.
Now back to Ninjatrader, has NT better simulation features, like historic bid/asks and/or optimizer function calls?
Thanks,
Arthemis
Comment
-
Hello,
Thanks for the forum post and welcome to the forums.
Unfortunately although we do allow some custom coding in this area it is all un-supported and as such we really do not have any documentation on the process or if this would even be possible.For the most part we do not support calling the optimizer from code to allow it to run at a set interval and take the results from it for use. This is all done via the GUI in NInjaTrader.
-BrettBrettNinjaTrader Product Management
Comment
-
Thanks Brett, for clarifying the capabilities of the optimization feature.
The most important issue for me is the simulation part. In the NT7 help guide I saw the functions MarketDataType.Bid / .Ask. Does these functions allow me to capture historic bid/ask prices, during a back test or live trading, by placing them in an initializing function, like this?
And if so, how can I refer to a specific bid/ask from n bars ago?Code:protected override void Initialize() { Add(string instrumentName, PeriodType.Minute, 1, MarketDataType.Bid); Add(string instrumentName, PeriodType.Minute, 1, MarketDataType.Ask); }
Thank you,
Arthemis
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
633 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
364 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
567 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
568 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment