NexusFi: Find Your Edge


Home Menu

 





System Optimization Fitness Functions


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one fluxsmith with 7 posts (11 thanks)
    2. looks_two Trader.Jon with 4 posts (1 thanks)
    3. looks_3 gordo with 3 posts (5 thanks)
    4. looks_4 flyscalper with 2 posts (0 thanks)
      Best Posters
    1. looks_one pakricard with 2 thanks per post
    2. looks_two gordo with 1.7 thanks per post
    3. looks_3 fluxsmith with 1.6 thanks per post
    4. looks_4 baruchs with 1.5 thanks per post
    1. trending_up 16,036 views
    2. thumb_up 27 thanks given
    3. group 10 followers
    1. forum 27 posts
    2. attach_file 4 attachments




 
Search this Thread

System Optimization Fitness Functions

  #11 (permalink)
 fluxsmith 
Santa Maria
 
Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker: Mirus/Zen-Fire
Trading: ES
Posts: 290 since May 2010
Thanks Given: 97
Thanks Received: 322


flyscalper View Post
I would like to get an optimization type as a Calmar Ratio: Annual Profit / DD max...

For annual profit I would suggest systemPerformance.AllTrades.TradesPerformance.TradesPerDay * 365 * systemPerformance.AllTrades.TradesPerformance.Currency.CumProfit / systemPerformance.AllTrades.Count

(There may be better ways, that's without pulling up documentation or intellisense)

Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
Exit Strategy
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
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
19 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #12 (permalink)
 MooreTech 
Orlando, Florida
 
Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Trading: ES
Posts: 57 since Aug 2010
Thanks Given: 6
Thanks Received: 73

Store the date of the first and last trades as follows:

 
Code
 DateTime start = new DateTime();
            DateTime stop = new DateTime();
            bool init = false;

            foreach (Trade t in systemPerformance.AllTrades.LosingTrades)
            {
                if (!init)
                {
                    init = true;
                    start = t.Entry.Time.Date;
                }
                stop = t.Entry.Time.Date;
                
            }
Then you can determine Annual Profits as (systemPerformance.AllTrades.TradesPerformance.GrossProfit + systemPerformance.AllTrades.TradesPerformance.GrossLoss) / number of years;


flyscalper View Post
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


Follow me on Twitter Reply With Quote
Thanked by:
  #13 (permalink)
 flyscalper 
Barcelona, Spain
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: Futures
Posts: 24 since Jul 2009
Thanks Given: 35
Thanks Received: 7


Hi guys,

thank you for the suggestions. I will try it very soon. MooreTech, your approach is a little more complicated than the fluxsmith's one. Don't you think it is possible to calculate the way he says?

Un saludo,

Pablo

Reply With Quote
  #14 (permalink)
 MooreTech 
Orlando, Florida
 
Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Trading: ES
Posts: 57 since Aug 2010
Thanks Given: 6
Thanks Received: 73

Yes I believe his is a simpler approach. Didn't see his answer before I posted.



flyscalper View Post
Hi guys,

thank you for the suggestions. I will try it very soon. MooreTech, your approach is a little more complicated than the fluxsmith's one. Don't you think it is possible to calculate the way he says?

Un saludo,

Pablo


Follow me on Twitter Reply With Quote
  #15 (permalink)
 
bizman70's Avatar
 bizman70 
toronto, ontario
 
Experience: Intermediate
Platform: ninja trader
Broker: sterling, iqfeed
Trading: es, nq, 6e
Posts: 363 since May 2010
Thanks Given: 41
Thanks Received: 140

we found that using a total of 10000 totals works well - ie - 50 generations with 200 populations -



MooreTech View Post
Yes I believe his is a simpler approach. Didn't see his answer before I posted.


Visit my NexusFi Trade Journal Reply With Quote
  #16 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184


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,

Sometimes I wonder if I go in circles, then I realize I haven't, which then makes me wonder even more .. I was using various 'optimization functions' available to NT7, and after a long day and night of jumping from one machine to another VM and back again (and seeing the same results too many times) I thought for sure I was ready for sleep so I did ... in the morning the results were still there ... blessed be: your Quality3.cs is giving me the same results, both on variables inputs AND $$/trades summary that the SQN.cs ( ) is producing ...
the only diff is the very nice 'performance' rating supplied by your code (4+ rating in a test of a long only strategy in a period of choppy bearish action)

now I dont know if I should be

or
or
or

Any thoughts ? I KNOW the code is different, just wondering if you had noticed the parallel results?

Jon

Reply With Quote
Thanked by:
  #17 (permalink)
 fluxsmith 
Santa Maria
 
Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker: Mirus/Zen-Fire
Trading: ES
Posts: 290 since May 2010
Thanks Given: 97
Thanks Received: 322


Trader.Jon View Post
...Any thoughts ? I KNOW the code is different [vs SQN.cs], just wondering if you had noticed the parallel results?

They're based on the same principle, so they would often return the same scoring order of parameters. Mine does try to make some adjustments for conservatism, and annualizes the score, which is why on a backtest over less than a year you'll see higher scores on mine (and lower scores on a backtest over more than a year).

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #18 (permalink)
 
bizman70's Avatar
 bizman70 
toronto, ontario
 
Experience: Intermediate
Platform: ninja trader
Broker: sterling, iqfeed
Trading: es, nq, 6e
Posts: 363 since May 2010
Thanks Given: 41
Thanks Received: 140

why would it work better to try to backtest and optimize on a very long time frame - markets change all the time - i find that when i backtest for about 60-90 days and walkforward about 30 days it gives pretty good results overall for the next week or so to live run -
what i am still having a difficult time with is finding the right parameter set count - where a function or system will automaticlly calculate the population number and iterations it needs based on the parameter set count

Visit my NexusFi Trade Journal Reply With Quote
  #19 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184


bizman70 View Post
why would it work better to try to backtest and optimize on a very long time frame - markets change all the time - i find that when i backtest for about 60-90 days and walkforward about 30 days it gives pretty good results overall for the next week or so to live run -
what i am still having a difficult time with is finding the right parameter set count - where a function or system will automaticlly calculate the population number and iterations it needs based on the parameter set count

I look at markets as having different personalities when they are bullish or bearish, so different parameters or even different straegies may have to be used.

Personally, I feel that it is better to optimize on the most demanding conditions: currently I am working on LONG ONLY(testing in choppy bearish time period) and SHORT ONLY(testing in choppy bullish time period) testing of strategies.

TJ

Reply With Quote
  #20 (permalink)
 pakricard 
Indonesia
 
Experience: Beginner
Platform: NT
Trading: FDAX
Posts: 29 since Jan 2011
Thanks Given: 13
Thanks Received: 18


Before reading this thread I thought the GOOD strategy should have:

- Good profits
- Good win/loss ratio
- Few number of trades

And until now I have been using the attached code.

After reading this thread I've seen I've been simplystic, so I'll use some of your ideas. Also has anyone worked on Expectancy score optimization ?

Attached Files
Elite Membership required to download: MaxSB.cs
Reply With Quote




Last Updated on April 29, 2011


© 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