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


NinjaTrader Genetic Optimizer
Updated: Views / Replies:54,153 / 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

  #61 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
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
 
  #62 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
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
 
  #63 (permalink)
Elite Member
St. Paul, MN.
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Zen-Fire
Favorite Futures: ES, equity options.
 
AynRandFan's Avatar
 
Posts: 29 since Sep 2009
Thanks: 10 given, 50 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
 
  #64 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,574 given, 3,982 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...

Reply With Quote
 
  #65 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
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:

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


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:
 
  #66 (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,240 since Jun 2009
Thanks: 29,354 given, 83,237 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

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
 
  #67 (permalink)
Elite Member
Calgary Canada
 
Futures Experience: Intermediate
Platform: Ninja
Broker/Data: IB/Kinetic
Favorite Futures: 6E, CL
 
jackyd's Avatar
 
Posts: 47 since Jun 2009
Thanks: 44 given, 18 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
 
  #68 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
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
 
  #69 (permalink)
Elite Member
Calgary Canada
 
Futures Experience: Intermediate
Platform: Ninja
Broker/Data: IB/Kinetic
Favorite Futures: 6E, CL
 
jackyd's Avatar
 
Posts: 47 since Jun 2009
Thanks: 44 given, 18 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
 
  #70 (permalink)
Member
California
 
Futures Experience: Beginner
Platform: NinjaTrader
 
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

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)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

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 06:49 PM.

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-16 in 0.16 seconds with 20 queries on phoenix via your IP 54.145.16.43