NinjaTrader Genetic Optimizer - futures io
futures io



NinjaTrader Genetic Optimizer


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one piersh with 49 posts (94 thanks)
    2. looks_two Big Mike with 26 posts (10 thanks)
    3. looks_3 TraderDJB with 13 posts (18 thanks)
    4. looks_4 dsraider with 10 posts (0 thanks)
      Best Posters
    1. looks_one piersh with 1.9 thanks per post
    2. looks_two TraderDJB with 1.4 thanks per post
    3. looks_3 sam028 with 0.5 thanks per post
    4. looks_4 Big Mike with 0.4 thanks per post
    1. trending_up 66,670 views
    2. thumb_up 134 thanks given
    3. group 47 followers
    1. forum 197 posts
    2. attach_file 19 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

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

 
Search this Thread
 

NinjaTrader Genetic Optimizer

(login for full post details)
  #1 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received

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
Click image for larger version

Name:	Screenshot.png
Views:	1182
Size:	7.5 KB
ID:	153   Click image for larger version

Name:	Screenshot v1.03.png
Views:	2151
Size:	14.7 KB
ID:	1648  
Reply With Quote

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(186 thanks from 22 posts)
looks_twoSalao's Journalby Salao
(51 thanks from 11 posts)
looks_3Deetee’s DAX Trading Journal (time based)by Deetee
(38 thanks from 18 posts)
looks_4Learning to Profit - A journey in algorithms and optionsby Syntax
(31 thanks from 14 posts)
looks_5Maybe a little bit different journalby Malykubo
(14 thanks from 15 posts)
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Big Mike in Ecuador
76 thanks
The Crude Dude Oil Trading System
65 thanks
Help improve the FIO community
36 thanks
Would You Sell Your System?
34 thanks
futures io site changelog and issues/problem reporting
27 thanks
 
(login for full post details)
  #2 (permalink)
 wh 
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
 
wh's Avatar
 
Posts: 538 since Jun 2009
Thanks: 298 given, 505 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
 
(login for full post details)
  #3 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,675 since Jun 2009
Thanks: 3,790 given, 4,507 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.

Follow me on Twitter Reply With Quote
The following user says Thank You to sam028 for this post:
 
(login for full post details)
  #4 (permalink)
piersh
California
 
 
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:
 
(login for full post details)
  #5 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

This looks really interesting!


Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #6 (permalink)
 goforbroke01 
Chicago
 
Experience: Intermediate
Platform: NT
Broker: IB
 
Posts: 11 since Jun 2009
Thanks: 8 given, 1 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
 
(login for full post details)
  #7 (permalink)
piersh
California
 
 
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:
 
(login for full post details)
  #8 (permalink)
 goforbroke01 
Chicago
 
Experience: Intermediate
Platform: NT
Broker: IB
 
Posts: 11 since Jun 2009
Thanks: 8 given, 1 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
 
(login for full post details)
  #9 (permalink)
 Peter 
Brisbane; Australia
 
Experience: Intermediate
Platform: NT
Broker: IB/TDA needing new broker
Trading: Futures, Forex, Stocks
 
Peter's Avatar
 
Posts: 97 since Jun 2009
Thanks: 91 given, 113 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?

Reply With Quote
The following user says Thank You to Peter for this post:
 
(login for full post details)
  #10 (permalink)
piersh
California
 
 
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:
 
(login for full post details)
  #11 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


goforbroke01 View Post
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

yup that's exactly what's happening. unfortunately the support for custom optimizers in NT is very sparse, but I've added a hack that should work around this...

Reply With Quote
The following 2 users say Thank You to piersh for this post:
 
(login for full post details)
  #12 (permalink)
 goforbroke01 
Chicago
 
Experience: Intermediate
Platform: NT
Broker: IB
 
Posts: 11 since Jun 2009
Thanks: 8 given, 1 received

Piersh - thanks for your help.

Reply With Quote
 
(login for full post details)
  #13 (permalink)
 Peter 
Brisbane; Australia
 
Experience: Intermediate
Platform: NT
Broker: IB/TDA needing new broker
Trading: Futures, Forex, Stocks
 
Peter's Avatar
 
Posts: 97 since Jun 2009
Thanks: 91 given, 113 received

Thanks for the info and warning. I was thinking on using it foremost as screening tool and then run the GO on subsets.

However my coding is apparently not good enough to find a working code with the info Swig provided.
Would you have an example of a code snippet where this trick is used that you can share? (just the part related to the trick to see how the coding related to enums should be done).

Reply With Quote
 
(login for full post details)
  #14 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received

ok, this is where it gets silly.

v1.03 includes support for optimizing Enum parameter values. If your strategy has a parameter that's an Enum, then the right hand side of the optimizer options dialog will show a scrolling list of those parameters and the possible values that each one can have. check the boxes on the right next to each value to test that value. check the box on the left next to the parameter name to toggle all the checkboxes on the right.

as always, please let me know if you have any problems.

Attached Thumbnails
Click image for larger version

Name:	Screenshot v1.03.png
Views:	287
Size:	14.7 KB
ID:	273  
Reply With Quote
The following 3 users say Thank You to piersh for this post:
 
(login for full post details)
  #15 (permalink)
 Peter 
Brisbane; Australia
 
Experience: Intermediate
Platform: NT
Broker: IB/TDA needing new broker
Trading: Futures, Forex, Stocks
 
Peter's Avatar
 
Posts: 97 since Jun 2009
Thanks: 91 given, 113 received

Ok, I ask for some code to put me on track in a VW and you build a Rolls Royce.
Now you're showing off
Thanks I will try it.

Reply With Quote
 
(login for full post details)
  #16 (permalink)
tortexal
Panama!
 
 
Posts: 44 since Jun 2009
Thanks: 1 given, 24 received

Piersh this optimizer is absolutely fantastic. I just tried that other one (not the original but another version) that is on the NT forums recently and its extremely slow compared to yours even with the same settings. I get about 5.1-5.3 ips on that one and 9-9.5 on yours. Thank you so much for releasing this, i can run every test in 30 min vs the hours it took on the default optimizer.

Reply With Quote
 
(login for full post details)
  #17 (permalink)
 Todd 
Alpharetta, GA
 
Experience: Intermediate
Platform: ninja
Broker: Mirus / Zenfire
Trading: ES
 
Todd's Avatar
 
Posts: 257 since Jun 2009
Thanks: 28 given, 40 received

Piersh,

Thanks for posting the optimizers... I've not used an optimizer with NT, only with TradeStation and only a little practice there.

Do I download the zip file into the indicator file? Is the optimizer pretty easy to use or do I need instruction?

Todd

Reply With Quote
 
(login for full post details)
  #18 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


tortexal View Post
Piersh this optimizer is absolutely fantastic. I just tried that other one (not the original but another version) that is on the NT forums recently and its extremely slow compared to yours even with the same settings. I get about 5.1-5.3 ips on that one and 9-9.5 on yours. Thank you so much for releasing this, i can run every test in 30 min vs the hours it took on the default optimizer.

Thanks! I'm glad you're finding it useful! That default optimizer was so tedious, I can't believe I wasted all that time...

Reply With Quote
 
(login for full post details)
  #19 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


Todd View Post
Piersh,

Thanks for posting the optimizers... I've not used an optimizer with NT, only with TradeStation and only a little practice there.

Do I download the zip file into the indicator file? Is the optimizer pretty easy to use or do I need instruction?

Todd

Todd,

I'd recommend familiarizing yourself with NT's default optimizer/strategy analyzer just to get a feel for the workflow. then follow the installation instructions at the top of this thread...

Reply With Quote
 
(login for full post details)
  #20 (permalink)
 Todd 
Alpharetta, GA
 
Experience: Intermediate
Platform: ninja
Broker: Mirus / Zenfire
Trading: ES
 
Todd's Avatar
 
Posts: 257 since Jun 2009
Thanks: 28 given, 40 received

Thanks, Piersh... I'll do that.

Reply With Quote
 
(login for full post details)
  #21 (permalink)
tortexal
Panama!
 
 
Posts: 44 since Jun 2009
Thanks: 1 given, 24 received

Piersh, is there anyway you can add an option to specify minimum # of trades so that it only returns the best results of values that trade more than the min? this has helped me in the past to avoid curve fitting.

Reply With Quote
 
(login for full post details)
  #22 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


tortexal View Post
Piersh, is there anyway you can add an option to specify minimum # of trades so that it only returns the best results of values that trade more than the min?

Unfortunately, NT's optimization API doesn't provide this information (at least, I couldn't find a way to retrieve it).

In order to do what you want, you'll have to write a custom OptimizationType. I'd recommend doing this since it gives you much greater control over the results.

- take a look in your "My Documents\NinjaTrader 6.5\bin\Custom\Type" directory. you'll see the classes for the various built-in optimization types (eg. 'max. avg. profit' is in @MaxAvgProfit.cs.
- make a copy of one of these files, change the file name, the class name (to match) and the 'DisplayName' attribute, and have at it!

I have been using a custom method that limits the min/max avg. trades per day (it returns double.NegativeInifinity when there are too many or too few trades), and tries to maximize the expectancy per trade while minimizing the draw-down.

you can get the average number of trades per day like this:
 
Code
systemPerformance.AllTrades.Count / (Strategy.BackTestTo - Strategy.BackTestFrom).TotalDays

Reply With Quote
The following 2 users say Thank You to piersh for this post:
 
(login for full post details)
  #23 (permalink)
kekkis
Norway
 
 
Posts: 6 since Jun 2009
Thanks: 1 given, 1 received

I tried to find crossover method in your GA optimizer but could'nt find. I think it's very important function to find solutions fast. I just saw reproduce. but there is no method which crossovers parents values.
Maybe I am just blind.


regards.

Reply With Quote
 
(login for full post details)
  #24 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


kekkis View Post
I tried to find crossover method in your GA optimizer but could'nt find. I think it's very important function to find solutions fast. I just saw reproduce. but there is no method which crossovers parents values.
Maybe I am just blind.


regards.

is this the bit you mean?

 
Code
// Take an attribute from parents
DNA parent = (_rand.Next (100) < 50) ? parentA : parentB;
rgParams [iParam] = parent.GetParam (iParam);

Reply With Quote
 
(login for full post details)
  #25 (permalink)
kekkis
Norway
 
 
Posts: 6 since Jun 2009
Thanks: 1 given, 1 received

For me this looks like, it just takes parents values, but not make crossover for values. I have to read your code again.

Reply With Quote
 
(login for full post details)
  #26 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

piersh,

Fantastic work. I'm just using it today for the first time as I've been focused on discretionary stuff, but I wanted to do a bit of optimization today on my rules set.

I have a request: could you make the GO spit out the variable name and the most optimized setting, at the end of the run (output dialog). ie:

Optimized results:
(Parameter, value)
JMA, 14
ZL, 28
Stop, 8
Target, 8

etc.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #27 (permalink)
 CRCTrader 
NY State
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus/Zen-Fire
Trading: Futures, Options
 
Posts: 3 since Jul 2009
Thanks: 0 given, 0 received


piersh View Post
Hi All,

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


Installation Instructions:
- back up the file ""My Documents\NinjaTrader 6.5\bin\Custom\Strategy\@Strategy.cs" first (call it @Strategy.cs.bak)
- copy the enclosed .cs files to your "My Documents\NinjaTrader 6.5\bin\Custom\Strategy" directory.
- edit an indicator or strategy and build it (F5).
- 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.

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 ;-)


If possible, please detail what you mean by "edit an indicator or strategy and build it (F5)"

Thank-you!

Reply With Quote
 
(login for full post details)
  #28 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


CRCTrader View Post
If possible, please detail what you mean by "edit an indicator or strategy and build it (F5)"

Thank-you!

certainly, i have updated the original post at the top of this thread to include more detail on this step.

Reply With Quote
 
(login for full post details)
  #29 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


Big Mike View Post
piersh,

Fantastic work. I'm just using it today for the first time as I've been focused on discretionary stuff, but I wanted to do a bit of optimization today on my rules set.

I have a request: could you make the GO spit out the variable name and the most optimized setting, at the end of the run (output dialog). ie:

Optimized results:
(Parameter, value)
JMA, 14
ZL, 28
Stop, 8
Target, 8

etc.

Mike

sure. until then, though. you can select the best performing result in the strategy analyzer and see the parameter in the grid (see attachment).

Attached Thumbnails
Click image for larger version

Name:	Untitled.png
Views:	476
Size:	105.8 KB
ID:	683  
Reply With Quote
The following user says Thank You to piersh for this post:
 
(login for full post details)
  #30 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received


piersh View Post
sure. until then, though. you can select the best performing result in the strategy analyzer and see the parameter in the grid (see attachment).

Yeah I know, but with a lot of parms it gets real messy real fast. If you can add it great, if not I can live.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #31 (permalink)
 CRCTrader 
NY State
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus/Zen-Fire
Trading: Futures, Options
 
Posts: 3 since Jul 2009
Thanks: 0 given, 0 received


piersh View Post
Hi All,

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


Installation Instructions:
- back up the file ""My Documents\NinjaTrader 6.5\bin\Custom\Strategy\@Strategy.cs" first (call it @Strategy.cs.bak)
- copy the enclosed .cs files to your "My Documents\NinjaTrader 6.5\bin\Custom\Strategy" directory.
- edit an indicator or strategy and build it:
- in the main NT window, go to the 'Tools->Edit Ninjascript->Indicator' menu
- select any indicator, and click OK
- click the 'compile' button (in the toolbar, to the right of the binoculars). alternatively, hit F5
- click 'OK' when the 'Indicator successfully generated' dialog appears.
- 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.

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 ;-)

I backed up @strategy.cs simply by copying and pasting and renaming file to @strategy.cs.bk IS THAT CORRECT
Saved PHGo to proper file
Then when to Utilities and >Import Ninja Strategy. That is when it blew up again. Doesn't allow.
Suggestions?

Reply With Quote
 
(login for full post details)
  #32 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


CRCTrader View Post
I backed up @strategy.cs simply by copying and pasting and renaming file to @strategy.cs.bk IS THAT CORRECT
Saved PHGo to proper file
Then when to Utilities and >Import Ninja Strategy. That is when it blew up again. Doesn't allow.
Suggestions?

oh, sorry. please check the updated instructions. they now detail how to install.

one day i'll get around to improving this...

Reply With Quote
 
(login for full post details)
  #33 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

piersh,

1.04 doesn't properly list the # of combinations it would seem. 1.03 was fine. For combinations, 1.04 is just outputting the instrument name.

ZN 09-09: PH Optimizer Start @ 7/23/2009 12:14:37 AM, combinations: ZN 09-09

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #34 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

Hi piersh,

Also at some point of combinations, the error "Failed to call method Optimize for optimizer 'PHGenetic': Index was out of range." occurs.

I am not sure at what point this happens, but I have run into it a couple of times on a very complex money management strategy I am writing that auto adjusts multiple stops and targets, it has about 30 parameters to optimize, and some of those have a wide variety of values.

It is easy to work around, I just reduce the set of combinations, but wanted to make you aware of it incase you weren't. It may just be a limitation.

Last, I was wondering if you would consider adding a Stop time to the Output box, or an ETA so we know how long the job took to complete.

On a wish list, I'd like to see your own Window (like the options window) stay open during the optimization job and update with stats on-the-fly, would be very cool.

BTW, do you have a website? Are you accepting donations for your hard work?

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #35 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

Oops - I just noticed you updated the first post to include the # of combinations fix. I will install it soon (in middle of a large job) and then I can report back some better figures perhaps to my last post.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #36 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

It seems to break when it goes above 4,096,xxx,xxx,xxx,xxx,xxx,xxx. I think that is understandable and clearly an enormous number. I will rewrite some of my logic so I can do with fewer optimization variables.

Here is the last one that was successful for me:

ZN 09-09: PH Optimizer Start @ 7/25/2009 5:34:42 AM, combinations: 3,976,005,110,290,448,384

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #37 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


Big Mike View Post
It seems to break when it goes above 4,096,xxx,xxx,xxx,xxx,xxx,xxx. I think that is understandable and clearly an enormous number. I will rewrite some of my logic so I can do with fewer optimization variables.

Here is the last one that was successful for me:

ZN 09-09: PH Optimizer Start @ 7/25/2009 5:34:42 AM, combinations: 3,976,005,110,290,448,384

Mike

ok, the new limit is 79,228,162,514,264,337,593,543,950,335

if you hit that then you're out of luck ;-)

Reply With Quote
 
(login for full post details)
  #38 (permalink)
 caprica 
USA
 
Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 112 received

I optimize on things other than net profit and wonder if you could make this wonderful script display not just the performance of whatever I am optimizing on but also the net profit. For instance, many times I optimize on max expectancy but a high value will many times yield a very low net profit. I'd like to be able to see both as the optimization is progressing so I know when to abort the process.

So for instance if you optimize on something other than net profit, it would show:

ES 09-09: gen 1/20, 20.5 ips, PERF: [max 1.05, stability: 4.55], net profit: [$ 15,612.50]
ES 09-09: gen 2/20, 20.5 ips, PERF: [max 1.25, stability: 4.95], net profit: [$ 17,550.25]

Reply With Quote
 
(login for full post details)
  #39 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 208 received

Piersh hi,
Great staf.
I have a question. Maybe you can help.
Its about Walk Forward. The sequence now in NT is:
Load min. bars required>optimize(Optimization period - min. bars required)>Load min. bars required>Test(Test period - min. bars required)> New Optimization (From date + Test period) etc.
My problem is that if Test Period is 7 days and min. bars required are 100 on a 10 min. time frame and a day session (8:30-15:15), this mean that 2 days are not tested.
Is there a way to move the "From Date" back on each iteration to achieve the correct sequence:
optimize(Optimization period)>Test(Test period)>New optimize.

Regards,
Baruch

Reply With Quote
 
(login for full post details)
  #40 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


caprica View Post
I optimize on things other than net profit and wonder if you could make this wonderful script display not just the performance of whatever I am optimizing on but also the net profit. For instance, many times I optimize on max expectancy but a high value will many times yield a very low net profit. I'd like to be able to see both as the optimization is progressing so I know when to abort the process.

So for instance if you optimize on something other than net profit, it would show:

ES 09-09: gen 1/20, 20.5 ips, PERF: [max 1.05, stability: 4.55], net profit: [$ 15,612.50]
ES 09-09: gen 2/20, 20.5 ips, PERF: [max 1.25, stability: 4.95], net profit: [$ 17,550.25]

unfortunately not, there's no way for the optimizer to get access to the underlying performance data required to do this.

my suggestion is that you build this rule into your scoring function. either as a weight, (eg. multiply your score by the net profit), or as a cut-off (eg. return double.NegativeInfinity for all scores with avg daily net profit less than a certain value).

Reply With Quote
 
(login for full post details)
  #41 (permalink)
 caprica 
USA
 
Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 112 received


piersh View Post
unfortunately not, there's no way for the optimizer to get access to the underlying performance data required to do this.

my suggestion is that you build this rule into your scoring function. either as a weight, (eg. multiply your score by the net profit), or as a cut-off (eg. return double.NegativeInfinity for all scores with avg daily net profit less than a certain value).

Thanks, I am currently using the * netprofit method but it has a lot of drawbacks. I'll try the double.NegativeInfinity advice. I will see if I can modify your popup dialog window to include a minimum threshold to pass to the optimizer for this variable.

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
(login for full post details)
  #42 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


baruchs View Post
Piersh hi,
Great staf.
I have a question. Maybe you can help.
Its about Walk Forward. The sequence now in NT is:
Load min. bars required>optimize(Optimization period - min. bars required)>Load min. bars required>Test(Test period - min. bars required)> New Optimization (From date + Test period) etc.
My problem is that if Test Period is 7 days and min. bars required are 100 on a 10 min. time frame and a day session (8:30-15:15), this mean that 2 days are not tested.
Is there a way to move the "From Date" back on each iteration to achieve the correct sequence:
optimize(Optimization period)>Test(Test period)>New optimize.

Regards,
Baruch

sorry, i'm not too familiar with the details of walk forward. you might find more useful answers in a more general forum - it doesn't sound like your issue is directly connected with the optimizer, but NT's walk forward function (of which the optimizer is a small part). do you see the same problem using NT's built-in optimizer?

Reply With Quote
 
(login for full post details)
  #43 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 208 received

Yes in default optimizer its the same.
I all ready asked the NT support but all they could say is that they will forward it to the development. I don't count on a solution from them.
The problem exists in optimizer also, but in optimizer I added my own "trade from date" and in NT "From" I enter a smaller date.
As I see it the strongest tool in NT is the Walk Farward, because the optimizer optimizes on a given data and only if you test it on next data sample the strategy is valid.

Thanks,
Baruch

Reply With Quote
 
(login for full post details)
  #44 (permalink)
 mrticks 
Dublin, Ireland.
 
Experience: Advanced
Platform: NinjaTrader, TOS, Multicharts, Open Source various
Trading: FDAX, cable/yen, FX, options on commodities
 
mrticks's Avatar
 
Posts: 67 since Jun 2009
Thanks: 16 given, 10 received

Thank you piersh! I have used it to change my stop loss ticks and trail stops. Appreciate it!

Reply With Quote
 
(login for full post details)
  #45 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

Hi piersh,

I'm using v1.06 but on one particular strategy am getting an error. I've used your GO successfully on several strategies, this is the first I've seen this.

Failed to call method 'Optimize' for optimizer 'PHGenetic'. Unable to cast object of type 'System.Double' to type 'System.String'.

It works fine with the normal optimizer.

My guess is it is trying to Print() something when the error occurs. I am making this assumption because I receive your pop-up Window with options, and as soon as I press OK the error appears -- before your header statement is printed to the Output window.

Sorry I can't include the strategy for you to test against. Any ideas where to begin? I will try looking through your code and commenting out some Print() statements to see if my theory is right, but I guess it could easily be something else. Not sure why you would be converting something to a string elsewhere though.

-- Edit. Hmm ok you have overriden the ToString() function and it seems do a lot of custom work using ToString. So... hopefully you have any idea how to fix this, maybe you can send a test version with more debug output.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #46 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

Well I see you already wrapped Optimize() in a try/catch so I enabled the Catch and printed the exception:

 
Code
                            
System.InvalidCastExceptionUnable to cast object of type 'System.Double' to type 'System.String'.
   
at NinjaTrader.Strategy.Parameter.set_Value(Object value)
   
at NinjaTrader.Strategy.IntegralParameterDefinition.WriteValue(StrategyBase strategyInt32 iValue)
   
at NinjaTrader.Strategy.PHGenetic.ScoreGeneration(IEnumerable`1 rgChildren)
   at NinjaTrader.Strategy.PHGenetic.Optimize() 
I will check further but your help is appreciated.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #47 (permalink)
 sefstrat 
Austin, TX
 
Experience: Advanced
Platform: NT/Matlab
Broker: Interactive Brokers
Trading: FX majors
 
sefstrat's Avatar
 
Posts: 285 since Jun 2009
Thanks: 20 given, 760 received

Hey Mike, I've run into a similar problem before and was trying to remember what caused it.. iirc it was something like this:

Print("string " + intVar + 5);

Technically this is valid c#, but for some reason the JIT compiler NT is using has trouble with it (they use modified JIT engine for remotesoft protector). It is especially annoying because their replacement hooks the MS JIT compiler with unmanaged code, so you cannot debug such problems with visual studio..

I found that changing it to this made it work:

Print("string " + (intVar+5).ToString());

Not sure if that is the problem in your case but worth a shot.

Reply With Quote
 
(login for full post details)
  #48 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

thx sefstrat, I have run into that before. But that is not the issue here as best I can tell. If you take a look at PHgenetic.cs from post 1 I think you'll see why.

Hopefully piersh can help.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #49 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


Big Mike View Post
Well I see you already wrapped Optimize() in a try/catch so I enabled the Catch and printed the exception:

 
Code
                            
System.InvalidCastExceptionUnable to cast object of type 'System.Double' to type 'System.String'.

   
at NinjaTrader.Strategy.Parameter.set_Value(Object value)
   
at NinjaTrader.Strategy.IntegralParameterDefinition.WriteValue(StrategyBase strategyInt32 iValue)
   
at NinjaTrader.Strategy.PHGenetic.ScoreGeneration(IEnumerable`1 rgChildren)
   at NinjaTrader.Strategy.PHGenetic.Optimize() 
I will check further but your help is appreciated.

Mike

try changing the lines (line ~1007)

 
Code
else
{
	_rgParameterDefinitions.Add (new IntegralParameterDefinition (Strategy, iParam));
}
to

 
Code
else if (type.IsPrimitive)
{
	_rgParameterDefinitions.Add (new IntegralParameterDefinition (Strategy, iParam));
}

Reply With Quote
The following user says Thank You to piersh for this post:
 
(login for full post details)
  #50 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received


piersh View Post
try changing the lines (line ~1007)

 
Code
else
{
    _rgParameterDefinitions.Add (new IntegralParameterDefinition (Strategy, iParam));
}
to

 
Code
else if (type.IsPrimitive)
{
    _rgParameterDefinitions.Add (new IntegralParameterDefinition (Strategy, iParam));
}

Thank you, that seems to have corrected it.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #51 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


Big Mike View Post
Thank you, that seems to have corrected it.

Mike

ok, good.

i'd suggest using Enum parameters instead of string parameters when appropriate in your indicators/strategies - you'll be able to optimize over the different values of any enum parameters in your strategy.

Reply With Quote
 
(login for full post details)
  #52 (permalink)
 caprica 
USA
 
Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 112 received

piersh i am enjoying this very much so thank you. i have noticed however the occasionally i make some code changes such as a Print() statement or commenting out such a statement, and when i re-run the optimizer the old code is still present. i am 100000% positive the new code was compiled and i have seen this on at least a half dozen occasions. it seems the information is cached and the only way to correct is to exit ninja and restart.

fyi.

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
(login for full post details)
  #53 (permalink)
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
 
RJay's Avatar
 
Posts: 688 since Jun 2009
Thanks: 748 given, 780 received


caprica View Post
piersh i am enjoying this very much so thank you. i have noticed however the occasionally i make some code changes such as a Print() statement or commenting out such a statement, and when i re-run the optimizer the old code is still present. i am 100000% positive the new code was compiled and i have seen this on at least a half dozen occasions. it seems the information is cached and the only way to correct is to exit ninja and restart.

fyi.

caprica,

I may have run into something similar building custom chart types.

NT sometimes needs to reload the IntellisenseCache before changes become active.

Importing anything triggers a request on restart or edit.

RJay

Reply With Quote
The following 2 users say Thank You to RJay for this post:
 
(login for full post details)
  #54 (permalink)
 caprica 
USA
 
Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 112 received


RJay View Post
caprica,

I may have run into something similar building custom chart types.

NT sometimes needs to reload the IntellisenseCache before changes become active.

Importing anything triggers a request on restart or edit.

RJay

thx i reached same conclusion (intellisense cache). could just delete it but i find easier to restart. however i dont recall ever seeing this before using piersh GO so was thinking might be something to do with the Dispose method and his GC method? it isn't a huge deal so long as I know it is occurring but what is scary is if i change code and did not realize it was cached i may dismiss code changes as ineffective when in fact they were not evaluated to begin with.

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
(login for full post details)
  #55 (permalink)
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
 
RJay's Avatar
 
Posts: 688 since Jun 2009
Thanks: 748 given, 780 received


caprica View Post
thx i reached same conclusion (intellisense cache). could just delete it but i find easier to restart. however i dont recall ever seeing this before using piersh GO so was thinking might be something to do with the Dispose method and his GC method? it isn't a huge deal so long as I know it is occurring but what is scary is if i change code and did not realize it was cached i may dismiss code changes as ineffective when in fact they were not evaluated to begin with.

Been there, done that!!!!

Reply With Quote
 
(login for full post details)
  #56 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


caprica View Post
piersh i am enjoying this very much so thank you. i have noticed however the occasionally i make some code changes such as a Print() statement or commenting out such a statement, and when i re-run the optimizer the old code is still present. i am 100000% positive the new code was compiled and i have seen this on at least a half dozen occasions. it seems the information is cached and the only way to correct is to exit ninja and restart.

fyi.

huh, that's weird. i've never seen this behavior myself but that might be because I always use an external editor (visual studio) and never open my code files in NT.

if you can find a way to reliably reproduce this problem, let me know and I'll try to work out if it's the optimizer causing it...

Reply With Quote
 
(login for full post details)
  #57 (permalink)
 Kris 
Dallas
 
Experience: Beginner
Platform: NinjaTrader
Broker: Ameritrade
Trading: ETFs
 
Posts: 1 since Aug 2009
Thanks: 0 given, 0 received

This is a spectacular tool - thanks!

Is there any way to get it to auto-continue if you run an optimization on a basket of securities? (it prompts after each)

Reply With Quote
 
(login for full post details)
  #58 (permalink)
 AynRandFan 
St. Paul, MN.
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: ES, equity options.
 
AynRandFan's Avatar
 
Posts: 29 since Sep 2009
Thanks: 10 given, 52 received

Piersh, As my very first post here, I want to thank you for the exceptional effort here with this optimizer -- it's an incredibly valuable tool that you've shared here with everybody! I truly wish I had something equally cool to share with you.... If you ever come to St. Paul, Minnesota, the beer is ABSOLUTELY on me. An absolutely massive contribution. Just incredible.

Reply With Quote
 
(login for full post details)
  #59 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


Kris View Post
This is a spectacular tool - thanks!

Is there any way to get it to auto-continue if you run an optimization on a basket of securities? (it prompts after each)

Sorry. I can't find a way to do this . The ninjatrader optimizer Api is very rudimentary and it doesn't allow one to acces this kind of information from within the optimizer. Let's hope they improve it in nt7...

Reply With Quote
 
(login for full post details)
  #60 (permalink)
 AynRandFan 
St. Paul, MN.
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: ES, equity options.
 
AynRandFan's Avatar
 
Posts: 29 since Sep 2009
Thanks: 10 given, 52 received

Piersh, please forgive me for what is probably a stupid question, but is there some easy way to test out a strategy in multiple time periods? For example, testing a basic moving average strategy for 1 minute, 2 minutes, 3 minutes, 4 minutes... etc... all the way to 60 minutes, just as an example, --all in one long test? Again, I thank you for sharing this with everybody. I've been up the whole night (the past 2 nights!) playing with this thing... it's just awesome...!

Reply With Quote
 
(login for full post details)
  #61 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


AynRandFan View Post
Piersh, As my very first post here, I want to thank you for the exceptional effort here with this optimizer -- it's an incredibly valuable tool that you've shared here with everybody! I truly wish I had something equally cool to share with you.... If you ever come to St. Paul, Minnesota, the beer is ABSOLUTELY on me. An absolutely massive contribution. Just incredible.

thanks for your kind words. i hope it helps you find a strategy that works for you.

Reply With Quote
 
(login for full post details)
  #62 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


AynRandFan View Post
Piersh, please forgive me for what is probably a stupid question, but is there some easy way to test out a strategy in multiple time periods? For example, testing a basic moving average strategy for 1 minute, 2 minutes, 3 minutes, 4 minutes... etc... all the way to 60 minutes, just as an example, --all in one long test? Again, I thank you for sharing this with everybody. I've been up the whole night (the past 2 nights!) playing with this thing... it's just awesome...!

not stupid at all - I have long wished there was a way to do exactly what you're asking for. but the Ninjatrader API is just too simplistic I believe that NT7 will support this, whenever that might be...

Reply With Quote
 
(login for full post details)
  #63 (permalink)
 AynRandFan 
St. Paul, MN.
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: ES, equity options.
 
AynRandFan's Avatar
 
Posts: 29 since Sep 2009
Thanks: 10 given, 52 received


piersh View Post
ok, this is where it gets silly.

v1.03 includes support for optimizing Enum parameter values. If your strategy has a parameter that's an Enum, then the right hand side of the optimizer options dialog will show a scrolling list of those parameters and the possible values that each one can have. check the boxes on the right next to each value to test that value. check the box on the left next to the parameter name to toggle all the checkboxes on the right.

as always, please let me know if you have any problems.

May I ask you for a bit more discussion on how you create something like this? This looks absolutely incredible... it's probably something simple that I'm just not grasping here at 4AM, but some discussion on creating something like this would be appreciated by others here on the forum as time rolls forward... I have no doubt about it. Thanks again for this incredible tool, Piersh -- I've used it to prove (to myself) the incredible value of trailing stops (I'm honestly stunned at the merit inherent in trailing stops), as well as another concept that seemed so far away from me just a few days ago (the value of much longer-term moving averages, particularly with Renko bars); Renko bars don't have a fixed time in any case, but they do have a fixed range -- longer-term moving averages play very well with Renko bars, and it's pretty crazy to think about 60-bar trades when the time used for each bar is undefined in the first place. Your tool has really made me grasp the market in a much more profound and deep way. Anyhow, if you could elaborate a bit more on the post above, (which I will try and quote, here), that would be very cool. Thanks again.

Reply With Quote
 
(login for full post details)
  #64 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,675 since Jun 2009
Thanks: 3,790 given, 4,507 received


AynRandFan View Post
Piersh, please forgive me for what is probably a stupid question, but is there some easy way to test out a strategy in multiple time periods? For example, testing a basic moving average strategy for 1 minute, 2 minutes, 3 minutes, 4 minutes... etc... all the way to 60 minutes, just as an example, --all in one long test? Again, I thank you for sharing this with everybody. I've been up the whole night (the past 2 nights!) playing with this thing... it's just awesome...!

For optimizing with different time periods, why not using something like:
 
Code
                            
 Add(PeriodType.MinutefirstTP);
Add(PeriodType.MinutesecondTP); 
where firstTP and secondTP are parameters.
Then the optimizer can increment these parameters, that's it...

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #65 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


AynRandFan View Post
May I ask you for a bit more discussion on how you create something like this?

sure, first of all, make sure you're familiar with Enums.

now, if you expose a property on your strategy that is an Enum value, the optimizer will allow you to vary that property as part of the optimization.

for example, many of the indicators that come with NT have PriceTypeSupported set to true, which means you can change the dataseries mapped to the indicator's Input by changing the PriceType.

so... you can expose this PriceType property on your strategy, like this:

 
Code
                            
        [Category ("Parameters")]

        public 
PriceType PriceType
        
{
            
get { return _priceType; }
            
set _priceType value; }
        }
        
PriceType _priceType
then you can pass this value into the indicator when you add it:

 
Code
                            
        Indicator.Indicator _ema;


        protected 
override void Initialize()
        {
            
Add (_ema EMA (15));
            
_ema.PriceType this.PriceType;
            ... 
I'm keeping a reference to the indicator locally, so I don't have to keep initializing it later:

 
Code
                            
        protected override void OnBarUpdate ()

        {
            if (
_ema [0] > _ema [1])
                
EnterLong ();
            else
                
EnterShort ();
        } 
now when you run the optimizer, it'll show the following dialog:



which allows you to choose which values of PriceType you wish to test.

hope that helps!

Reply With Quote
The following 4 users say Thank You to piersh for this post:
 
(login for full post details)
  #66 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received


sam028 View Post
For optimizing with different time periods, why not using something like:
 
Code
                            
 Add(PeriodType.MinutefirstTP);
Add(PeriodType.MinutesecondTP); 
where firstTP and secondTP are parameters.
Then the optimizer can increment these parameters, that's it...

Won't work, the Add() method can not be optimized against. At least not by NT 6.5, supposed to be fixed in 7.

Unless piersh has a work around?

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #67 (permalink)
 jackyd 
Calgary Canada
 
Experience: Intermediate
Platform: Ninja
Broker: IB/Kinetic
Trading: 6E, CL
 
jackyd's Avatar
 
Posts: 47 since Jun 2009
Thanks: 44 given, 20 received

Thanks Piersh for this wicked tool.

I have a question if you don't mind. In the EMA example you provided, is there a way to also access a plot/dataseries and still gain control over the price type the way you have outlined above?

For instance...

Say I wanted to use the DoubleMA indicator which has a plot called "Signal". I would usually do it in the OnBarUpdate something like this, but I wouldn't have control over the pricetype...

 
Code
_dmaSignal0 = DoubleMA(1, NinjaTrader.Indicator.DoubleMA_internal_DMAType.EMA, 1, NinjaTrader.Indicator.DoubleMA_internal_DMAType.EMA).Signal[0];

if (_dmaSignal0 > 0) ...
But, if I defined it in Initialize() as you have, it would look something like this...

 
Code
Add(_dma = DoubleMA(1, NinjaTrader.Indicator.DoubleMA_internal_DMAType.EMA, 1, NinjaTrader.Indicator.DoubleMA_internal_DMAType.EMA));
 _dma.PriceType = this.PriceType;
So, at this point, how would I reference the Signal plot that reflects the pricetype enum I want?

I tried a few things, but nothing seems to work for me.

Thanks

Reply With Quote
 
(login for full post details)
  #68 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


jackyd View Post
Thanks Piersh for this wicked tool.

I have a question if you don't mind. In the EMA example you provided, is there a way to also access a plot/dataseries and still gain control over the price type the way you have outlined above?

For instance...

Say I wanted to use the DoubleMA indicator which has a plot called "Signal". I would usually do it in the OnBarUpdate something like this, but I wouldn't have control over the pricetype...

 
Code
_dmaSignal0 = DoubleMA(1, NinjaTrader.Indicator.DoubleMA_internal_DMAType.EMA, 1, NinjaTrader.Indicator.DoubleMA_internal_DMAType.EMA).Signal[0];

if (_dmaSignal0 > 0) ...
But, if I defined it in Initialize() as you have, it would look something like this...

 
Code
Add(_dma = DoubleMA(1, NinjaTrader.Indicator.DoubleMA_internal_DMAType.EMA, 1, NinjaTrader.Indicator.DoubleMA_internal_DMAType.EMA));
 _dma.PriceType = this.PriceType;
So, at this point, how would I reference the Signal plot that reflects the pricetype enum I want?

I tried a few things, but nothing seems to work for me.

Thanks


you should be able to use

 
Code
                            
_dma.Signal[0
in your OnBarUpdate(), although I haven't tried that particular indicator in a while - i use my own that doesn't look as nice, but uses less CPU.

one cool thing you can do with DoubleMA is parameterize the MA types in the optimizer.

for example:
 
Code
                            
Add(_dma DoubleMA(_maPeriod1_maType1_maPeriod2_maType2)); 

add corresponding properties in your strategy for those parameters and the optimizer will try to find the best set...

Reply With Quote
 
(login for full post details)
  #69 (permalink)
 jackyd 
Calgary Canada
 
Experience: Intermediate
Platform: Ninja
Broker: IB/Kinetic
Trading: 6E, CL
 
jackyd's Avatar
 
Posts: 47 since Jun 2009
Thanks: 44 given, 20 received


piersh View Post
you should be able to use

 
Code
                            
_dma.Signal[0

that's what I thought too, but it won't work for me. I did these tests...
 
Code
double test1 = DoubleMA(30, NinjaTrader.Indicator.DoubleMA_internal.DMAType.WMA, 30, NinjaTrader.Indicator.DoubleMA_internal.DMAType.WMA).Signal[0]; // compiles OK

double test2 = _dma[0]; // compiles OK

double test3 = _dma.Signal[0]; // doesn't compile
with the _dma.Signal[0] I get an error that the
Quoting 
NinjaTrader.Indicator.Indicator" does not contain a definition for Signal.

I think I'm missing something obvious, but not sure what.

It's very cool though, can't wait to start testing with it.

Reply With Quote
 
(login for full post details)
  #70 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


jackyd View Post


Quoting 
NinjaTrader.Indicator.Indicator" does not contain a definition for Signal.

It's very cool though, can't wait to start testing with it.

ah! try changing the declaration of _dma to
 
Code
                            
DoubleMA _dma

Reply With Quote
 
(login for full post details)
  #71 (permalink)
 jackyd 
Calgary Canada
 
Experience: Intermediate
Platform: Ninja
Broker: IB/Kinetic
Trading: 6E, CL
 
jackyd's Avatar
 
Posts: 47 since Jun 2009
Thanks: 44 given, 20 received

That's it! mucho gracias amigo

Reply With Quote
 
(login for full post details)
  #72 (permalink)
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
 
cclsys's Avatar
 
Posts: 607 since Nov 2009
Thanks: 248 given, 392 received

Piersh, I am still stumbling terribly with Ninja and only now, after a year, preparing to get into some simple strategy testing because I find/found the interface so difficult to learn and also I tend not to use mechanical strategies for short term trading anyway. But in this case I feel like a real dunce. I cannot open it up at all.

I backed up the default cs. I imported the two other cs's but not the info.xml.

I F5'd an indicator.

I closed it down and opened it again.

I can see PHOptimizer in the list of strategies in the Strat Analysis page.

Then I am stumped. If I pick an instrument to optimize, PH is not in the list. I can't see any other menus.

Am I supposed to use the PH strategy embedded in other ones? Or am I supposed to see it in the drop-down menu but for some reason it isn't there. Or am I supposed to have done something else which I missed somewhere.

Sorry for the trouble, but now I want to see dis thang!

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #73 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

It's the drop down under optimizer, not strategy selection but below that, under 'net profit' or whatever you optimize against.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #74 (permalink)
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
 
cclsys's Avatar
 
Posts: 607 since Nov 2009
Thanks: 248 given, 392 received

Ah! Thanks. I thought I must be doing something dumb. Didn't understand the lingo in the instructions.

Now that picture with the HMA, EMA, Zerolag etc. etc., that was somebody else's strategy, not part of the optimizer per se, right?

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #75 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


cclsys View Post
Ah! Thanks. I thought I must be doing something dumb. Didn't understand the lingo in the instructions.

sorry about that


cclsys View Post
Now that picture with the HMA, EMA, Zerolag etc. etc., that was somebody else's strategy, not part of the optimizer per se, right?

yeah, that half of the options dialog is only available when your strategy has Enum or bool-valued parameters. see this post for more details:

Reply With Quote
 
(login for full post details)
  #76 (permalink)
 gabga100 
New York
 
Experience: Advanced
Platform: NT
 
gabga100's Avatar
 
Posts: 147 since Nov 2009
Thanks: 44 given, 70 received


piersh View Post
sorry about that



yeah, that half of the options dialog is only available when your strategy has Enum or bool-valued parameters. see this post for more details:


Hi Piersh,

Any idea if this works with NT 7?

Thanks

Reply With Quote
 
(login for full post details)
  #77 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


gabga100 View Post
Hi Piersh,

Any idea if this works with NT 7?

Thanks

no, unfortunately i didn't get on the NT7 beta

if you want to bug them to let me in, i'd be more than happy to make sure it runs, or fix it if it doesn't

Reply With Quote
 
(login for full post details)
  #78 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received

ok, i got NT7 and I'm working on porting this over...

Reply With Quote
The following 3 users say Thank You to piersh for this post:
 
(login for full post details)
  #79 (permalink)
 sam028 
Site Moderator
 
 
sam028's Avatar
 
Posts: 3,675 since Jun 2009
Thanks: 3,790 given, 4,507 received


piersh View Post
ok, i got NT7 and I'm working on porting this over...

Their is already a native GO in NT7, but your GO looks really better, so it's a good idea to port it .

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
 
(login for full post details)
  #80 (permalink)
 gabga100 
New York
 
Experience: Advanced
Platform: NT
 
gabga100's Avatar
 
Posts: 147 since Nov 2009
Thanks: 44 given, 70 received

Yes , Piersh's one is much more sophisticated....

It would be nice that it did not stop at every stock when you test a list though .....

Reply With Quote
 
(login for full post details)
  #81 (permalink)
 kronie 
NYC + NY / USA
 
Experience: Advanced
Platform: "I trade, therefore, I AM!"; Theme Song: "Atomic Dog!"
Trading: EMD, 6J, ZB
 
kronie's Avatar
 
Posts: 798 since Oct 2009


piersh View Post
Unfortunately, NT's optimization API doesn't provide this information (at least, I couldn't find a way to retrieve it).

In order to do what you want, you'll have to write a custom OptimizationType. I'd recommend doing this since it gives you much greater control over the results.

- take a look in your "My Documents\NinjaTrader 6.5\bin\Custom\Type" directory. you'll see the classes for the various built-in optimization types (eg. 'max. avg. profit' is in @MaxAvgProfit.cs.
- make a copy of one of these files, change the file name, the class name (to match) and the 'DisplayName' attribute, and have at it!

I have been using a custom method that limits the min/max avg. trades per day (it returns double.NegativeInifinity when there are too many or too few trades), and tries to maximize the expectancy per trade while minimizing the draw-down.

you can get the average number of trades per day like this:
 
Code
systemPerformance.AllTrades.Count / (Strategy.BackTestTo - Strategy.BackTestFrom).TotalDays

sorry for being so new to NT6.x programming, but I am going to need 2 introductory paragrahs, that help bridge the gap between this fine piece of work that you did and why I need it,

I have other canned strategies that I have bought / lease, but I haven't written any, nor do I use them to back / forward test ideas, so how would this fine piece of work benefit me?

thanks

Reply With Quote
 
(login for full post details)
  #82 (permalink)
 gabga100 
New York
 
Experience: Advanced
Platform: NT
 
gabga100's Avatar
 
Posts: 147 since Nov 2009
Thanks: 44 given, 70 received

Modyifing the optimisation type allow you to fine-tune how a combinations of parameters is "evaluated" against the others in an historical back-test .... profict factor being the default one is not the best one ... nor maximum profit

I would recommend that you read the miscellanous section in NT/downloads ... there is a lot about customized opt types ...

You know what you know but you do not know what you do not know.
You do not see things how they are, you see things how you are.
In life you do what you want but you do not want what you want.
Reply With Quote
 
(login for full post details)
  #83 (permalink)
 gabga100 
New York
 
Experience: Advanced
Platform: NT
 
gabga100's Avatar
 
Posts: 147 since Nov 2009
Thanks: 44 given, 70 received

This is what I have as Default optimization type , a risk adjusted Total profit :

 
Code
                            
public override double GetPerformanceValue(SystemPerformance systemPerformance)
   {
      if (
systemPerformance.AllTrades.Count <= ||
systemPerformance.AllTrades.TradesPerformance.Percent.AvgProfit == 0)
         return 
0;
      else{                
         return 
Math.Sqrt(systemPerformance.AllTrades.Count)*
(
systemPerformance.AllTrades.TradesPerformance.Percent.AvgProfit)/
(
systemPerformance.AllTrades.TradesPerformance.Percent.StdDev) ;
   }


You know what you know but you do not know what you do not know.
You do not see things how they are, you see things how you are.
In life you do what you want but you do not want what you want.
Reply With Quote
The following user says Thank You to gabga100 for this post:
 
(login for full post details)
  #84 (permalink)
 goforbroke01 
Chicago
 
Experience: Intermediate
Platform: NT
Broker: IB
 
Posts: 11 since Jun 2009
Thanks: 8 given, 1 received

Piersh

The native GO in NT7 doesn't work properly. It looks like they had a go and then stopped without completing it. Your GO is something I use all the time on 6.5 and has become indispensable. Thanks for your massive contribution!

I know you said you were looking at it with NT7. Is it looking promising?

-thanks

Reply With Quote
 
(login for full post details)
  #85 (permalink)
 gabga100 
New York
 
Experience: Advanced
Platform: NT
 
gabga100's Avatar
 
Posts: 147 since Nov 2009
Thanks: 44 given, 70 received


goforbroke01 View Post
Piersh

The native GO in NT7 doesn't work properly. It looks like they had a go and then stopped without completing it. Your GO is something I use all the time on 6.5 and has become indispensable. Thanks for your massive contribution!

I know you said you were looking at it with NT7. Is it looking promising?

-thanks


Can you tell me more about it ? I used a couple of times and it works fine ......what did you hear exactly ?

You know what you know but you do not know what you do not know.
You do not see things how they are, you see things how you are.
In life you do what you want but you do not want what you want.
Reply With Quote
 
(login for full post details)
  #86 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


goforbroke01 View Post
I know you said you were looking at it with NT7. Is it looking promising?

yeah, i got some of it kinda ported over, but i ran into a problem with some weird exceptions that NT7 was throwing. i tried asking on the NT support forum but all I got back was the generic "buy into our affiliate support network" bullshit. after that i kinda lost motivation, but i dare say i'll get it working eventually...

Reply With Quote
The following user says Thank You to piersh for this post:
 
(login for full post details)
  #87 (permalink)
fafura
NYC
 
 
Posts: 1 since Oct 2009
Thanks: 0 given, 0 received

Piersh, It would be great if you could port it into NT7 as it would greatly speed up optimization process by using multiple cores of the CPU, not available in NT6.5

Reply With Quote
 
(login for full post details)
  #88 (permalink)
 earlyriser 
Denver
 
Experience: Intermediate
Platform: Ninja
Broker: Zen Fire
Trading: GC, CL
 
Posts: 12 since Jan 2010
Thanks: 6 given, 5 received

What is a Genetic Optimizer please? I tried google but confused the same.

Reply With Quote
 
(login for full post details)
  #89 (permalink)
 spikoloco 
Queretaro,Qro. Mexico
 
Experience: Intermediate
Platform: Ninja Trader, Multicharts
Broker: Mirus/Zen-Fire
Trading: ES
 
Posts: 34 since Nov 2009
Thanks: 5 given, 3 received

Excuse my igonarance, but what is a genetic optimizer? and how can it help my trading or my strategies? I don't believe in optimization as the market is constantly changing and if you optimize you, it only works for some time.....ST

Reply With Quote
 
(login for full post details)
  #90 (permalink)
 ArtCole 
Chicago
 
Experience: Advanced
Platform: NinjaTrader
 
Posts: 27 since Jan 2010
Thanks: 6 given, 2 received

Optimization is a vital step in the process of developing a robust strategy. Please do not confuse this with curve fitting.

Reply With Quote
 
(login for full post details)
  #91 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received


piersh View Post
yeah, i got some of it kinda ported over, but i ran into a problem with some weird exceptions that NT7 was throwing. i tried asking on the NT support forum but all I got back was the generic "buy into our affiliate support network" bullshit. after that i kinda lost motivation, but i dare say i'll get it working eventually...

piersh,

What can the users of futures.io (formerly BMT) do to help with this? I really dislike the GO in NT7. I want yours!

Maybe we can start a petition or something on your behalf, to show the amount of support you have behind you, so NT gives you the resources you need to get it fixed?

What else can we do to help?

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #92 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


Big Mike View Post
piersh,

What can the users of futures.io (formerly BMT) do to help with this? I really dislike the GO in NT7. I want yours!

Maybe we can start a petition or something on your behalf, to show the amount of support you have behind you, so NT gives you the resources you need to get it fixed?

What else can we do to help?

Mike

I made a bit of progress with the NT7 port. I should have something for you to try in a day or two...

Reply With Quote
The following 3 users say Thank You to piersh for this post:
 
(login for full post details)
  #93 (permalink)
 gabga100 
New York
 
Experience: Advanced
Platform: NT
 
gabga100's Avatar
 
Posts: 147 since Nov 2009
Thanks: 44 given, 70 received

Hi guys,


Not to discourage Piersh , who I am sure will do a fantastic job and make a state-of-art Genetic optimizer (probably much more fine-tunable) but ....


Did you know there is a new version of NT 7.0.0.6 which from what I can see contains a many changes ..... try to download it if you do not have it ....(same link)


Run huge backtests and many bugs was experiencing with the GO do not appear anymore ....

Let me know if the same for you ...

You know what you know but you do not know what you do not know.
You do not see things how they are, you see things how you are.
In life you do what you want but you do not want what you want.
Reply With Quote
 
(login for full post details)
  #94 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received

I've uploaded a new version v1.08, available here.

this version supports both NT6.5 & NT7, although I haven't done much testing with it so there may well be issues - let me know if it's not working for you...

Reply With Quote
The following 4 users say Thank You to piersh for this post:
 
(login for full post details)
  #95 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received


piersh View Post
I've uploaded a new version v1.08, available here.

this version supports both NT6.5 & NT7, although I haven't done much testing with it so there may well be issues - let me know if it's not working for you...

Hi Piersh,

I've had problems with regards to Aborting the optimization. When I click abort, it says "Aborting Please Wait" in Control Center, but the results never get populated.

 
Code
CL 03-10: gen 1/200, 43.2 ips, max PERF: 162.93, stability PERF: 54.08    Fast=90,    Slow=23
CL 03-10: gen 2/200, 43.5 ips, max PERF: 909.60, stability PERF: 220.97    Fast=88,    Slow=55
CL 03-10: gen 3/200, 46.4 ips, max PERF: 909.60, stability PERF: 459.05    Fast=88,    Slow=55
CL 03-10: gen 4/200, 48.1 ips, max PERF: 909.60, stability PERF: 551.48    Fast=88,    Slow=55
CL 03-10: gen 5/200, 49.6 ips, max PERF: 909.60, stability PERF: 582.28    Fast=88,    Slow=55
CL 03-10: gen 6/200, 50.6 ips, max PERF: 1,653.28, stability PERF: 730.80    Fast=14,    Slow=8
CL 03-10: gen 7/200, 49.6 ips, max PERF: 1,964.03, stability PERF: 1,067.70    Fast=14,    Slow=11
CL 03-10: gen 8/200, 49.4 ips, max PERF: 3,097.50, stability PERF: 1,558.31    Fast=13,    Slow=11
CL 03-10: gen 9/200, 49.1 ips, max PERF: 3,097.50, stability PERF: 1,740.34    Fast=13,    Slow=11
CL 03-10: gen 10/200, 48.7 ips, max PERF: 3,097.50, stability PERF: 1,831.45    Fast=13,    Slow=11
CL 03-10: gen 11/200, 48.5 ips, max PERF: 3,097.50, stability PERF: 1,831.45    Fast=13,    Slow=11
CL 03-10: reset
System.Exception: user aborted
   at NinjaTrader.Strategy.PHOptimizationMethod.RunIteration(ParameterSet child)
   at NinjaTrader.Strategy.PHOptimizationMethod.RunIterations[T](IEnumerable`1 rgChildren)
   at NinjaTrader.Strategy.PHGenetic.ScoreGeneration(IEnumerable`1 rgChildren)
   at NinjaTrader.Strategy.PHGenetic.Optimize()
Fast=    13
Slow=    11
I clicked abort on generation 11 above for instance, it threw this Exception.

I was just using the simple built-in crossover strategy.

NT7 beta 6.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #96 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


Big Mike View Post
I've had problems with regards to Aborting the optimization. When I click abort, it says "Aborting Please Wait" in Control Center, but the results never get populated.

Thanks, Mike! v1.09 should fix this issue.

Reply With Quote
The following user says Thank You to piersh for this post:
 
(login for full post details)
  #97 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received


piersh View Post
Thanks, Mike! v1.09 should fix this issue.

Awesome.

I just created a quick video that I'll be posting to the site soon, it features your optimizer so I'll post a link here after I finish uploading the video (will take a while). The video was just meant as a starting tutorial for creating strategies and optimizing them in NT.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #98 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,996 since Jun 2009
Thanks: 32,464 given, 98,266 received

Here is the video on creating a strategy, and optimizing using PH Genetic:


Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following 2 users say Thank You to Big Mike for this post:
 
(login for full post details)
  #99 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

First, thanks to piersh for creating this. It's exactly what I was looking for.

Second, has anyone been able to use this for all the combos with the SuperTrend? I've tried enuming all the different variables (period, multiplier, MA, smoothing period, mode) but am completely stuck. I've read every post on this thread but I still got nada. Anyway, any pointers would be greatly appreciated.

Thanks,
Dave

Reply With Quote
 
(login for full post details)
  #100 (permalink)
piersh
California
 
 
Posts: 87 since Jun 2009
Thanks: 5 given, 119 received


dsraider View Post
First, thanks to piersh for creating this. It's exactly what I was looking for.

Second, has anyone been able to use this for all the combos with the SuperTrend? I've tried enuming all the different variables (period, multiplier, MA, smoothing period, mode) but am completely stuck. I've read every post on this thread but I still got nada. Anyway, any pointers would be greatly appreciated.

Thanks,
Dave

you should only need to 'enum' the MA and mode parameters, the others will just be regular int/doubles. what's the problem you're seeing?

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > NinjaTrader Genetic Optimizer


Last Updated on December 16, 2010


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1,800 in prizes!

April
     



Copyright © 2021 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