Speeding up an Optimization by Avoiding Settings - NinjaTrader Programming | futures io social day trading
futures io futures trading


Speeding up an Optimization by Avoiding Settings
Updated: Views / Replies:739 / 8
Created: by stepseazy Attachments:0

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
 
Thread Tools Search this Thread
 

Speeding up an Optimization by Avoiding Settings

  #1 (permalink)
Elite Member
Ithaca, NY
 
Futures Experience: Beginner
Platform: Ninjatrader
Favorite Futures: CL
 
Posts: 7 since Oct 2011
Thanks: 1 given, 1 received

Speeding up an Optimization by Avoiding Settings

Programers, Ninjas, Martial Artists,

I have written a strategy that optimizes stop levels and take profits, but it takes forever to optimize since I usually use the default optimizer. I'd like it to just skip a setting if the stop is larger than the take profit. Right now I have an if statement so that the algorithm enters the trade only if the stop is <= the take profit. Is there a way to do this where the code just exits? I'm not a professional programmer so I'm not clear on how to approach this and would like suggestions from some pros who know how to make code faster. Thanks.

-steps

My current solution:

protected override void OnBarUpdate()
{
if (!(stopSmaller&&stop1>profit1))
{
EnterLongLimit(DefaultQuantity, (High[barsAgo]+ Low[barsAgo])/2-openDiff, "scale");
}
}

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Market Wizard
Cleveland Ohio/United States
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: various
Favorite Futures: futures
 
Posts: 2,388 since Jul 2012
Thanks: 1,138 given, 4,387 received
Forum Reputation: Legendary



stepseazy View Post
Programers, Ninjas, Martial Artists,

I have written a strategy that optimizes stop levels and take profits, but it takes forever to optimize since I usually use the default optimizer. I'd like it to just skip a setting if the stop is larger than the take profit. Right now I have an if statement so that the algorithm enters the trade only if the stop is <= the take profit. Is there a way to do this where the code just exits? I'm not a professional programmer so I'm not clear on how to approach this and would like suggestions from some pros who know how to make code faster. Thanks.

-steps

My current solution:

protected override void OnBarUpdate()
{
if (!(stopSmaller&&stop1>profit1))
{
EnterLongLimit(DefaultQuantity, (High[barsAgo]+ Low[barsAgo])/2-openDiff, "scale");
}
}


I'm not a Ninja person (I use Tradestation), but I'm guessing you have to set up the optimizer something like this:

Optimized variables are stop1 and profit1

You want to run cases of stop1 from say 1 to 20, and profit1 from 1 to 20, but stop1 has to be less than profit1


If that is the case, I would change your variables...

profit1 still the same
inc1 = new variable
stop1 = profit1 - inc1 (now this is a calculated variable, not one you set)

then you'd run cases of profit1 from 1 to 20, and inc1 from 1 to whatever

Then, stop1 would always be less than profit1


Hopefully this makes sense.

Reply With Quote
 
  #4 (permalink)
Elite Member
Ithaca, NY
 
Futures Experience: Beginner
Platform: Ninjatrader
Favorite Futures: CL
 
Posts: 7 since Oct 2011
Thanks: 1 given, 1 received

Kev,

Very good solution, thanks. That does make a lot of sense. Not sure why I didn't think of that LOL. I wish I could change the optimizer logic though. Maybe I'm being too ambitious.

-steps

Reply With Quote
 
  #5 (permalink)
Elite Member
Northern Germany
 
Futures Experience: Intermediate
Platform: NT
Favorite Futures: FDAX, CL
 
vvhg's Avatar
 
Posts: 1,583 since Mar 2011
Thanks: 1,016 given, 2,807 received


stepseazy View Post
Programers, Ninjas, Martial Artists,

I have written a strategy that optimizes stop levels and take profits, but it takes forever to optimize since I usually use the default optimizer. I'd like it to just skip a setting if the stop is larger than the take profit. Right now I have an if statement so that the algorithm enters the trade only if the stop is <= the take profit. Is there a way to do this where the code just exits? I'm not a professional programmer so I'm not clear on how to approach this and would like suggestions from some pros who know how to make code faster. Thanks.

-steps

My current solution:

protected override void OnBarUpdate()
{
if (!(stopSmaller&&stop1>profit1))
{
EnterLongLimit(DefaultQuantity, (High[barsAgo]+ Low[barsAgo])/2-openDiff, "scale");
}
}


kevinkdog View Post
I'm not a Ninja person (I use Tradestation), but I'm guessing you have to set up the optimizer something like this:

Optimized variables are stop1 and profit1

You want to run cases of stop1 from say 1 to 20, and profit1 from 1 to 20, but stop1 has to be less than profit1


If that is the case, I would change your variables...

profit1 still the same
inc1 = new variable
stop1 = profit1 - inc1 (now this is a calculated variable, not one you set)

then you'd run cases of profit1 from 1 to 20, and inc1 from 1 to whatever

Then, stop1 would always be less than profit1


Hopefully this makes sense.

I think that could be a neat solution, but I would change it.
Let's say you are optimizing profit1 from 1 to 20 and inc 1-19, now when profit1 is 2 and inc is 19 you have a stop value of -17...no good...
This ensures that you don't end up with a negative stop:
 
Code
stop1 = Math.Max(1, profit1 - inc1); //now stop1 will alwas be 1 or bigger

I guess you were originally talking about sth. like (depending on the rest of your calculations, this might well be faster...):
 
Code
if(stop1>profit1) return;

vvhg

Hic Rhodos, hic salta.

Last edited by vvhg; December 21st, 2012 at 12:20 PM.
Reply With Quote
 
  #6 (permalink)
Elite Member
Ithaca, NY
 
Futures Experience: Beginner
Platform: Ninjatrader
Favorite Futures: CL
 
Posts: 7 since Oct 2011
Thanks: 1 given, 1 received

I think what he meant is

profit=stop+inc

where inc >=0, stop>=0

Reply With Quote
The following user says Thank You to stepseazy for this post:
 
  #7 (permalink)
Elite Member
Northern Germany
 
Futures Experience: Intermediate
Platform: NT
Favorite Futures: FDAX, CL
 
vvhg's Avatar
 
Posts: 1,583 since Mar 2011
Thanks: 1,016 given, 2,807 received


stepseazy View Post
I think what he meant is

profit=stop+inc

where inc >=0, stop>=0

That would work, but will always include unneccessary runs as it will always work up to profit = maximum stop + maximum inc.
So if you want to run stop from 1-20 and profit also 1-20 it will in fact run up to profit = 39 ( stop 20 + inc 19).

Vvhg


Sent from my iPad using Tapatalk HD

Hic Rhodos, hic salta.

Last edited by vvhg; December 22nd, 2012 at 03:36 AM.
Reply With Quote
 
  #8 (permalink)
Banned: trolling
NYC + NY / USA
 
Futures Experience: Advanced
Platform: "I trade, therefore, I AM!"; Theme Song: "Atomic Dog!"
Favorite Futures: EMD, 6J, ZB
 
kronie's Avatar
 
Posts: 798 since Oct 2009
Thanks: 216 given, 498 received

what about the other improvements?, such as turning off Windows Search (disable), or making the settings on your windows 7 or 8, SSD capable, hence making it take longer on some tasks, like File_Explorer, but faster within Ninja?

something like disabling Windows Search service

Reply With Quote
 
  #9 (permalink)
Elite Member
Waco TX.
 
Futures Experience: Advanced
Platform: Robinhood
Favorite Futures: STOCKS
 
quantismo's Avatar
 
Posts: 214 since Jul 2011
Thanks: 305 given, 145 received

Default Optimizer vs Genetic

I find for me using the default setting in Ninjatrader Optimization is going to take me 10 to 50 times longer then the genetic settings. The results you get in the default should always be fairly close to what you come up with using the genetic settings unless your sampling to few trades over a long time period or very short periods in general.
I suggest forget the default and waiting 3 hours to 3 days for it to complete a complex optimization and do it in 3 to 30 minutes in the genetic mode.

Quantismo

Reply With Quote

Reply



futures io > > > > > Speeding up an Optimization by Avoiding Settings

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
Speeding up NinjaTrader with a RAM drive (ramdisk) pawnbroker NinjaTrader 110 December 30th, 2014 05:18 AM
Avoiding trading loop in script mcteague NinjaTrader Programming 5 December 28th, 2012 03:18 AM
'Let's Just Do It,' Dimon Says of Avoiding 'Cliff' Quick Summary News and Current Events 0 December 12th, 2012 10:00 AM
.....SEC May Ticket Speeding Traders kbit News and Current Events 0 February 23rd, 2012 04:08 PM
Toyota Blames Driver Error for Unwanted Speeding Quick Summary News and Current Events 0 July 14th, 2010 03:20 AM


All times are GMT -4. The time now is 03:42 AM.

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