NinjaTrader Genetic Optimizer - NinjaTrader Programming | futures io social day trading
futures io futures trading


NinjaTrader Genetic Optimizer
Updated: Views / Replies:54,054 / 197
Created: by piersh Attachments:19

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 19  
 
Thread Tools Search this Thread
 

NinjaTrader Genetic Optimizer

  #1 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received

NinjaTrader Genetic Optimizer

Latest version (1.12), with NT7 support, is here

Hi All,

I've created a new Genetic Strategy Optimizer based loosely on Peter's GAOptimizer.


Installation Instructions:
- download the .ZIP file from the download link (above). NOTE: ignore the '1.09' in the filename - it's wrong, but i can't change it...
- in the main NT window, choose the "File->Utilities->Import NinjaScript" menu.
- when prompted, locate the downloaded .ZIP file
- in your strategy analyzer optimize dialog choose "PH Genetic" as the Optimizer.
- you can select whichever "Optimize on..." metric you like.
- when the "PH Genetic Options" dialog appears, hover over the controls to get a short description of what each option does.
- if you upgrade NT6.5, you'll need to re-install or uninstall the optimizer.

like most GA optimizers it does like to find a local maximum, although it'll attempt to kick out if it notices stability.

let me know if you have any problems/questions. i'll write some documentation soon, honest ;-)

- more info what's new here.
- brief instructions on how to optimize Enum values in your strategies, here.

Attached Thumbnails
NinjaTrader Genetic Optimizer-screenshot.png   NinjaTrader Genetic Optimizer-screenshot-v1.03.png  

Last edited by piersh; April 10th, 2010 at 03:56 AM. Reason: v1.12 - added MinimumPerformance cutoff
Reply With Quote
 
  #2 (permalink)
Elite Member
Neubrandenburg, Germany
 
Futures Experience: Advanced
Platform: R
Favorite Futures: Stocks
 
wh's Avatar
 
Posts: 538 since Jun 2009
Thanks: 297 given, 480 received

please use this else error when you do on explorer ...
C:\Users\trading\Documents\NinjaTrader 6.5\bin\Custom\Strategy>rename @Strategy.cs @Strategy.cs.bak

Reply With Quote
 
  #3 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,572 given, 3,982 received


It looks nice, but what did you add/modify ?
Is the % of Aliens are a random elements added during the selection process ?
Anyway, I'll test it, thx Piersh.

Reply With Quote
The following user says Thank You to sam028 for this post:
 
  #4 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


sam028 View Post
It looks nice, but what did you add/modify ?
Is the % of Aliens are a random elements added during the selection process ?
Anyway, I'll test it, thx Piersh.

hi sam, it's pretty much a complete rewrite:
  • it uses a different way of extracting the tested strategy's score. it uses a hack in base Strategy.Dispose to get around a design flaw in NT - they don't expose the value being optimized to the optimizer . this allows you to use whichever scoring metric you like without modification. i removed the logging/threshold stuff since this it uses the same scoring as the analyzer. you can add this in your custom OptimizationTypes, if necessary.
  • it uses an integral representation of the parameter space that allows it to ensure that all children are unique - reducing the number of backtest runs that are required.
  • it uses a fitness weighting function to more naturally choose the parents of the next generation. the chance that an individual gets to procreate is on a probability curve, not a boolean function. this increases the richness of the gene pool by allowing worse-performing individuals to procreate (albeit with lower probablility than others)
  • it makes an attempt to determine when a maximum has been found and the parameter space is stable (ie. subsequent generations are unlikely to produce any better individuals). it does this by checking the top 'stability size' % of the population - if they're the same between two generations, then it considers the parameter space to be stable. at this point it blows away (almost) the whole history and starts over with the top 'reset size' % of the previous lot, seeds the rest of the new generation with aliens and continues. if you find it's resetting too much, try increasing the 'stability size' percentage (a value of 100 means it'll never reset).
  • between resets, it creates new generations from all previous generations. this is necessary since new children are now unique. i might add an aging function to reduce the probability of those crusty great-great-great-grandparents getting some action...
  • it adds aliens. aliens are completely randomly generated (none of their genes are derived in any way from other individuals). a certain configurable percentage of every new generation are aliens, the rest are normal (possibly mutated) children of the previous generations. I added this because I found that while it slows convergence somewhat, it allows a broader search of the parameter space, helping to avoid local maximums.

i have found, at least with the strategy i'm using to test with and fine-grained parameter settings (2 billion individuals), that the parameter surface is very bumpy and the algorithm likes to get caught at the top of some local maximum without getting closer to the optimal set. it'll find a good solution quickly, but not necessarily the best.

Reply With Quote
The following 11 users say Thank You to piersh for this post:
 
  #5 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,220 received

This looks really interesting!


Reply With Quote
 
  #6 (permalink)
VIP Member
Chicago
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: IB
 
Posts: 11 since Jun 2009
Thanks: 8 given, 0 received

Piersh

Great work! I have a question - do you have a way of making this compatible with the NT walk forward function? Currently, every time it rolls forward, it stops and waits for user input to confirm the GO parameters

thanks

Reply With Quote
 
  #7 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


goforbroke01 View Post
Piersh

Great work! I have a question - do you have a way of making this compatible with the NT walk forward function? Currently, every time it rolls forward, it stops and waits for user input to confirm the GO parameters

thanks

oops, sorry i hadn't tried with walkforward. i've uploaded a new version (to the original post above) which should help a little. please let me know if it still doesn't work for you.

Reply With Quote
The following 3 users say Thank You to piersh for this post:
 
  #8 (permalink)
VIP Member
Chicago
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: IB
 
Posts: 11 since Jun 2009
Thanks: 8 given, 0 received

Piersh

thanks for the fix - runs ok except that after the first full run through, subsequent runs don't display the GO params form. It may be that the walkthrough flag persists, not being reset after the job is complete.

-thanks

Reply With Quote
 
  #9 (permalink)
Elite Member
Brisbane; Australia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: IB/TDA needing new broker
Favorite Futures: Futures, Forex, Stocks
 
Peter's Avatar
 
Posts: 97 since Jun 2009
Thanks: 91 given, 101 received

Piersh, thanks a lot for this. First time user of GO and am very very impressed. Could have saved me weeks in working with the NT built-in. Finally my computer can work with 6 parameters at once instead of just 3 and that in a fraction of the time..

I saw a mail from -Swig- on the NT forum about optimizing e.g. running multiple moving averages via a trick of assigning numbers to the MAs. Did you ever try that with your GO?


Last edited by Peter; June 21st, 2009 at 08:36 AM. Reason: typo
Reply With Quote
The following user says Thank You to Peter for this post:
 
  #10 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received



Peter View Post
I saw a mail from -Swig- on the NT forum about optimizing e.g. running multiple moving averages via a trick of assigning numbers to the MAs. Did you ever try that with your GO?

Yes indeed, I use Swig's neat trick in some of my strategies.

however, be warned that changing an MA (or MA combination) can have a drastic effect on the meaning of the other parameters, and the 'gene-splicing' of these other parameters makes little sense (in biological terms it's like cross breeding completely different species). this reasults in making the optimization surface much more bumpy, and the optimizer is more likely to get stuck in a local maximum. you might find that different runs of the optimizer will give you completely different results. I'm thinking that some kind of covariance decomposition would help with this, but that's a whole different kettle of fish.

Reply With Quote
The following user says Thank You to piersh for this post:

Reply



futures io > > > > > NinjaTrader Genetic Optimizer

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
MoGo Genetic Optimizer for NT7 TraderDJB NinjaTrader Programming 6 April 19th, 2012 09:52 AM
Index to Genetic Optimizers for NinjaTrader jdfagan NinjaTrader Programming 2 June 24th, 2010 06:09 AM
NinjaTrader 7.0 Strategy Analyzer and Optimizer tutorials? sev888 Traders Hideout 3 April 2nd, 2010 10:42 AM
How i use genetic optimizer in 10 steps wh NinjaTrader 6 June 15th, 2009 03:23 PM


All times are GMT -4. The time now is 01:52 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-13 in 0.15 seconds with 20 queries on phoenix via your IP 54.92.201.232