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


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

Welcome to futures io.

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

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

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

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

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

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

-- Big Mike, Site Administrator

Reply
 19  
 
Thread Tools Search this Thread
 

NinjaTrader Genetic Optimizer

  #41 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 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
 
  #42 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
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
 
  #43 (permalink)
Elite Member
Israel
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: pfg
Favorite Futures: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 206 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
 
  #44 (permalink)
Elite Member
Dublin, Ireland.
 
Futures Experience: Advanced
Platform: NinjaTrader, TOS, Multicharts, Open Source various
Favorite Futures: FDAX, cable/yen, FX, options on commodities
 
mrticks's Avatar
 
Posts: 67 since Jun 2009
Thanks: 16 given, 9 received

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


Last edited by mrticks; July 31st, 2009 at 07:29 AM.
Reply With Quote
 
  #45 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,218 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

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.


Last edited by Big Mike; August 19th, 2009 at 02:24 AM. Reason: Added stuff
Reply With Quote
 
  #46 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,218 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

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #47 (permalink)
Elite Member
Austin, TX
 
Futures Experience: Advanced
Platform: NT/Matlab
Broker/Data: Interactive Brokers
Favorite Futures: FX majors
 
sefstrat's Avatar
 
Posts: 285 since Jun 2009
Thanks: 20 given, 749 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
 
  #48 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,218 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

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #49 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
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:
 
  #50 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,218 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

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote

Reply



futures io > > > > > NinjaTrader Genetic Optimizer

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

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


All times are GMT -4. The time now is 12:43 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-11 in 0.13 seconds with 20 queries on phoenix via your IP 107.20.115.174