NexusFi: Find Your Edge


Home Menu

 





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 92,800 views
    2. thumb_up 134 thanks given
    3. group 47 followers
    1. forum 197 posts
    2. attach_file 19 attachments




 
Search this Thread

NinjaTrader Genetic Optimizer

  #81 (permalink)
 
kronie's Avatar
 kronie 
NYC + NY / USA
 
Experience: Advanced
Platform: "I trade, therefore, I AM!"; Theme Song: "Atomic Dog!"
Trading: EMD, 6J, ZB
Posts: 796 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

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
36 thanks
Tao te Trade: way of the WLD
24 thanks
Spoo-nalysis ES e-mini futures S&P 500
21 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #82 (permalink)
 
gabga100's Avatar
 gabga100 
New York
 
Experience: Advanced
Platform: NT
Posts: 147 since Nov 2009
Thanks Given: 44
Thanks Received: 72

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
  #83 (permalink)
 
gabga100's Avatar
 gabga100 
New York
 
Experience: Advanced
Platform: NT
Posts: 147 since Nov 2009
Thanks Given: 44
Thanks Received: 72


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
Thanked by:
  #84 (permalink)
 goforbroke01 
Chicago
 
Experience: Intermediate
Platform: NT
Broker: IB
Posts: 11 since Jun 2009
Thanks Given: 8
Thanks Received: 1

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
  #85 (permalink)
 
gabga100's Avatar
 gabga100 
New York
 
Experience: Advanced
Platform: NT
Posts: 147 since Nov 2009
Thanks Given: 44
Thanks Received: 72


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
  #86 (permalink)
piersh
California
 
Posts: 87 since Jun 2009
Thanks Given: 5
Thanks Received: 120


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
Thanked by:
  #87 (permalink)
fafura
NYC
 
Posts: 1 since Oct 2009
Thanks Given: 0
Thanks Received: 0

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
  #88 (permalink)
 earlyriser 
Denver
 
Experience: Intermediate
Platform: Ninja
Broker: Zen Fire
Trading: GC, CL
Posts: 12 since Jan 2010
Thanks Given: 6
Thanks Received: 5

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

Reply With Quote
  #89 (permalink)
 spikoloco 
Queretaro,Qro. Mexico
 
Experience: Intermediate
Platform: Ninja Trader, Multicharts
Broker: Mirus/Zen-Fire
Trading: ES
Posts: 34 since Nov 2009
Thanks Given: 7
Thanks Received: 3

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
  #90 (permalink)
 ArtCole 
Indianapolis, IN
 
Experience: Advanced
Platform: NinjaTrader
Frequency: Daily
Duration: Days
Posts: 27 since Jan 2010
Thanks Given: 6
Thanks Received: 2


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

Reply With Quote




Last Updated on December 16, 2010


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