Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
This is my first non-introduction post. I am a bit surprised this hasn't been asked (to the best of my knowledge).
In NT7, is it possible to call an optimization from within a strategy? Just to be clear, I am not talking about a walkforward optimization.
What I would like to do is to have some parameters change in time as part of an optimal-adaptive strategy. Suppose, say, on each bar update, take the last N bars, and find parameters A, B, and C via the NT7 GA that are optimal in some sense. At the moment I am not concerned with over-fitting, or overcomplication. I just want to know if it can be done.
Congratulations on a very unclassic approach! From my point of view, knowing that GA optimization can take significant resources that I would NOT want to incur on a trading computer during trading, I have a suggestion:
1. Setup another computer as your GA optimizer: you will have to guarantee dat consistency between that and your trade computer
2. Write-out the results to a shared text file of the paramters that you optimized and need to modify
3. Read that text file into your trading computer strategy during OnBarUpdate:
This indicator will read values from a .txt file, I've set the location of the file in the root directory, but you can change that to what ever you want.(c:\MyTextFile.txt)
I've set it up to hold 4 values:
EMAMin#12
EMAMax#24
StartTime#21:00
EndTime#09:00
…
No, I havent done it, but I think I think it amy be doable. My main concern is maintaining a good computing environment for that imnportant trading machine.
Ha! You really think it is that unusual of an approach? From my background it isn't that unusual or new at all (which makes my surprise that this is unusual all the more). My completely uneducated guess is that the big institutional algorithmic traders certainly do something like this.
But, you bring up a good point. Stability is important, and an embedded optimization would not increase stability. A proof-of-concent may be to run another instance of NT on the same machine, and use the text file transfer. That may work (as unelegant as it is).
I may look into the third-party NT7-compatible GA I saw on this forum. Wonder if it is invoke-able from a strategy?
Ah, good idea. However, anything beyond a text file is certainly beyond my current capabilities. If the text file thing works, then a more stable method of communication would certainly be desirable!
I would tend to agree that might be more practical if multiple instruments are in motion ... a file does have the distinction of being archival and also potential to be used for further development.
Coincidentally I thought about such an approach a week ago or so in the context of implementing an Encog-framework neural net (NN) -based strategy for NinjaTrader ("NT") -- not that I've developed a worthwhile NN-based strategy yet. By default the Encog configuration offloads training from any NN-based indicator or strategy to a separate C# (or Java) application IIRC mainly because of the processing burden.
I also agree the best approach may be sockets and poked around CodeProject.com a little to see what's involved. In brief it appears doable, the approach being to develop a DLL, refer to it in the NT NN-based indicator or strategy and periodically invoke the separate application with a training set via the DLL.
It may be also be possible (perhaps more reasonable) to work the other way around; namely, broadcast optimized parameters through a socket from a "server" training/optimization app (possibly including NT's strategy optimizer if the socket interface were embedded in the strategy), to be picked up by a live "client" strategy.
I'm not sure if it's an issue but one might have to be careful not to breach any rules regarding redistribution of data provided by a 3rd party.