System Optimization Fitness Functions - NinjaTrader Programming | futures io social day trading
futures io futures trading


System Optimization Fitness Functions
Updated: Views / Replies:9,112 / 27
Created: by fluxsmith Attachments:4

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

System Optimization Fitness Functions

  #1 (permalink)
Elite Member
Santa Maria
 
Futures Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker/Data: Mirus/Zen-Fire
Favorite Futures: ES
 
Posts: 295 since May 2010
Thanks: 101 given, 320 received

System Optimization Fitness Functions

My hope in starting this thread is that others will share their preferred fitness functions, that together we may come up with a better function. I know Big Mike has one I've never seen posted (hint), hopefully others also have ideas we can share in this area.

Here is mine at the moment (NT7), I would characterize it as a conservative variant of Van Tharp's System Quality Number:
 
Code
public override double GetPerformanceValue(SystemPerformance systemPerformance)
{
 // Normalize number of trades to one year
 int numTradesYear = (int)(systemPerformance.AllTrades.TradesPerformance.TradesPerDay * 365.0);
 
 
 // If it doesn't even trade once a week it isn't interesting to me
 if ( numTradesYear < 50 )
    return double.MinValue;
 
 
 // If it hasn't ever lost it is either unrealistic or doesn't have enough samples
 if ( systemPerformance.AllTrades.LosingTrades.Count == 0 )
    return double.MinValue;
 
 
 // Determine average profit with best outlier removed
 int numTrades = systemPerformance.AllTrades.Count - 1;
 double avgProfit = (systemPerformance.AllTrades.TradesPerformance.Currency.CumProfit - systemPerformance.AllTrades.TradesPerformance.Currency.LargestWinner) / numTrades;
 
 return Math.Sqrt(numTradesYear) * avgProfit / Math.Max(systemPerformance.AllTrades.TradesPerformance.Currency.StdDev, avgProfit * .20);
}

Reply With Quote
The following 2 users say Thank You to fluxsmith for this post:
 
  #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)
Elite Member
Israel
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: pfg
Favorite Futures: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 206 received


Hi,
I don't know if there is something called the best "fitness function".
The fitness function that I use gives the best results for the tested data.
It is - Net Profit divided by minus Draw Down. This gives you the best result PERIOD!
But what we are looking for is not the best result for the tested data, but the better predictor for future data.
As I always say optimization is worthless. The only allowed action is walk forward.

Baruch

Reply With Quote
The following user says Thank You to baruchs for this post:
 
  #4 (permalink)
Elite Member
Santa Maria
 
Futures Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker/Data: Mirus/Zen-Fire
Favorite Futures: ES
 
Posts: 295 since May 2010
Thanks: 101 given, 320 received


baruchs View Post
...Net Profit divided by minus Draw Down. This gives you the best result PERIOD!...

Thank you for responding. In my function I found if I don't impute some variance it greatly favored parameters that claim little or no variance (or drawdown), but only take a couple of ticks per trade. I can imagine the same problem with drawdown as a divisor, do you impute a threshold level of drawdown in your calculation?

Reply With Quote
 
  #5 (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

No I don't.
If you find a setup with Zero draw down you found a holy grail!!
Comparing two setups the best is with higher NP/DD

Baruch

Reply With Quote
 
  #6 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received

Walk and chew protein at same time


baruchs View Post
Hi,
I don't know if there is something called the best "fitness function".
The fitness function that I use gives the best results for the tested data.
It is - Net Profit divided by minus Draw Down. This gives you the best result PERIOD!
But what we are looking for is not the best result for the tested data, but the better predictor for future data.
As I always say optimization is worthless. The only allowed action is walk forward.

Baruch

I have a high degree of agreement with the walk forward. My gut feeling there is to do a default opt on a challenging month (ie periods of both high and low volatility, both bulls and bears getting greedy, and then use the best results are midpoints for the genetic optimization walk forward: 7 days test 1 day walk and then repeat.

Can you post your 'fitness function'? It would be very helpful to me to see the actual code.

TIA!
Jon

Reply With Quote
 
  #7 (permalink)
Elite Member
Santa Maria
 
Futures Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker/Data: Mirus/Zen-Fire
Favorite Futures: ES
 
Posts: 295 since May 2010
Thanks: 101 given, 320 received

I'm still trying to find the ideal fitness function. Net Profit / Drawdown as suggested here previously doesn't do it for me, as that ignores consistency and unrealized risk. The attached is the best I've come up with so far. For me the goal is to have a function that will sort to the top the same parameters I would select by hand based on visual analysis of the cumulative profit graph, which ideally would be a smooth progression from bottom left to top right; and when otherwise comparable preferring the smallest stops.

Attached Files
Register to download File Type: cs Quality3.cs (2.8 KB, 186 views)
Reply With Quote
The following user says Thank You to fluxsmith for this post:
 
  #8 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received

I love nice smooth equity curves


fluxsmith View Post
I'm still trying to find the ideal fitness function. Net Profit / Drawdown as suggested here previously doesn't do it for me, as that ignores consistency and unrealized risk. The attached is the best I've come up with so far. For me the goal is to have a function that will sort to the top the same parameters I would select by hand based on visual analysis of the cumulative profit graph, which ideally would be a smooth progression from bottom left to top right; and when otherwise comparable preferring the smallest stops.

fluxsmith,

I very much appreciate the analysis, and your sharing it with us ... I am a believer in removing those pesky outliers, as you have done in your code, and that leaves me confused as to the reasons for the different values used in the multiples (*.20 vs. *.382 ,to me, is huge for 1 trade difference). I am sure there is a good reasom, that is why I am asking to be educated, and as it wasnt included in the .cs :

.... this from Quality3.cs ... (.382)
// Determine average adusted profit
int numTrades = systemPerformance.AllTrades.Count;
double avgProfit = profit / numTrades;

return Math.Sqrt(numTradesYear) * avgProfit / Math.Max(systemPerformance.AllTrades.TradesPerformance.Currency.StdDev, avgProfit * .382);

compared to the original post ... (.20)
// Determine average profit with best outlier removed
int numTrades = systemPerformance.AllTrades.Count - 1;
double avgProfit = (systemPerformance.AllTrades.TradesPerformance.Currency.CumProfit - systemPerformance.AllTrades.TradesPerformance.Currency.LargestWinner) / numTrades;

return Math.Sqrt(numTradesYear) * avgProfit / Math.Max(systemPerformance.AllTrades.TradesPerformance.Currency.StdDev, avgProfit * .20);

TIA!
Jon


Last edited by Trader.Jon; August 13th, 2010 at 10:14 PM. Reason: clarification
Reply With Quote
 
  #9 (permalink)
Elite Member
Santa Maria
 
Futures Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker/Data: Mirus/Zen-Fire
Favorite Futures: ES
 
Posts: 295 since May 2010
Thanks: 101 given, 320 received

Experimentally I found .20 wasn't high enough, I settled on .382 as being representative of one standard deviation. What I'm doing there is imputing a minimum variance I'll accept for use in the calculation. Without that I found it gave too much preference to parameters that had low deviation only because they had minimal profit targets.

Reply With Quote
The following user says Thank You to fluxsmith for this post:
 
  #10 (permalink)
Elite Member
Barcelona, Spain
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: Futures
 
Posts: 24 since Jul 2009
Thanks: 35 given, 7 received

Calmar ratio


Hello,

I would like to get an optimization type as a Calmar Ratio: Annual Profit / DD max, but the problem is that I do not know how to compute the Annual Profit with the systemPerformance variables.

Un saludo,

Pablo

Reply With Quote

Reply



futures io > > > > > System Optimization Fitness Functions

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
Help with ADXVMA Optimization hunter548 NinjaTrader Programming 3 July 31st, 2011 04:49 PM
Expectancy custom fitness sam028 EasyLanguage Programming 13 September 29th, 2010 10:23 PM
Strategy Fitness Test Zach b NinjaTrader Programming 17 April 30th, 2010 12:04 AM
Music + neuronal functions max-td Traders Hideout 0 October 12th, 2009 10:04 AM


All times are GMT -4. The time now is 05:15 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-18 in 0.14 seconds with 20 queries on phoenix via your IP 23.22.136.56