NexusFi: Find Your Edge


Home Menu

 





Calling an Optimization in a Strategy


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one serac with 6 posts (8 thanks)
    2. looks_two d416 with 3 posts (5 thanks)
    3. looks_3 Trader.Jon with 2 posts (1 thanks)
    4. looks_4 sam028 with 1 posts (0 thanks)
      Best Posters
    1. looks_one bnichols with 2 thanks per post
    2. looks_two d416 with 1.7 thanks per post
    3. looks_3 serac with 1.3 thanks per post
    4. looks_4 Trader.Jon with 0.5 thanks per post
    1. trending_up 9,785 views
    2. thumb_up 16 thanks given
    3. group 10 followers
    1. forum 17 posts
    2. attach_file 0 attachments




 
Search this Thread

Calling an Optimization in a Strategy

  #1 (permalink)
 
serac's Avatar
 serac 
Arizona, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: MB Trading
Trading: Cello
Posts: 116 since Jan 2011
Thanks Given: 321
Thanks Received: 138

Hi all,

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.

Has anyone tried this?

Thanks!

Daniel (serac)

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Are there any eval firms that allow you to sink to your …
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Futures True Range Report
The Elite Circle
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #3 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184



serac View Post
Hi all,

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.
Daniel (serac)

Hi Daniel,

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:


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.

TJ

Reply With Quote
Thanked by:
  #4 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629

I agree with @Trader.Jon, but something smarter communicate with something else than a file is maybe better (sockets for example).

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #5 (permalink)
 
serac's Avatar
 serac 
Arizona, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: MB Trading
Trading: Cello
Posts: 116 since Jan 2011
Thanks Given: 321
Thanks Received: 138

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?

Thanks for your reply. You got me thinking...



Trader.Jon View Post
Hi Daniel,

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:


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.

TJ


Started this thread Reply With Quote
  #6 (permalink)
 
serac's Avatar
 serac 
Arizona, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: MB Trading
Trading: Cello
Posts: 116 since Jan 2011
Thanks Given: 321
Thanks Received: 138


sam028 View Post
I agree with @ Trader.Jon, but something smarter communicate with something else than a file is maybe better (sockets for example).

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!

Started this thread Reply With Quote
  #7 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184


sam028 View Post
I agree with @Trader.Jon, but something smarter communicate with something else than a file is maybe better (sockets for example).

sam,

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.

Jon

Reply With Quote
  #8 (permalink)
 
bnichols's Avatar
 bnichols 
Dartmouth NS
 
Experience: Intermediate
Platform: MC, MC.Net, NT, TWS
Broker: IB / IQFeed / Kids
Trading: Forex, stocks
Posts: 637 since Feb 2010
Thanks Given: 64
Thanks Received: 460

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.

Visit my NexusFi Trade Journal Reply With Quote
  #9 (permalink)
 
gordo's Avatar
 gordo 
Tonganoxie, Kansas
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: CL,6E
Posts: 160 since Nov 2009
Thanks Given: 129
Thanks Received: 401

How do I get the downloaded OptimizerType files to show up in the drop down menu? I copied the file into NinjaTrader7/bin/Custom/Type...now what???

Thanks.
Gordo

Visit my NexusFi Trade Journal Reply With Quote
  #10 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,399 since Jun 2009
Thanks Given: 33,175
Thanks Received: 101,539



gordo View Post
How do I get the downloaded OptimizerType files to show up in the drop down menu? I copied the file into NinjaTrader7/bin/Custom/Type...now what???

Thanks.
Gordo

Restart Ninja.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on September 2, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts