NexusFi: Find Your Edge


Home Menu

 





Optimization without curve fitting


Discussion in Traders Hideout

Updated
      Top Posters
    1. looks_one cunparis with 5 posts (1 thanks)
    2. looks_two sefstrat with 3 posts (6 thanks)
    3. looks_3 MXASJ with 3 posts (0 thanks)
    4. looks_4 baruchs with 2 posts (0 thanks)
    1. trending_up 12,091 views
    2. thumb_up 9 thanks given
    3. group 6 followers
    1. forum 17 posts
    2. attach_file 7 attachments




 
Search this Thread

Optimization without curve fitting

  #1 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093

I have developed 3 indicators that each test profitably. I've determined the optimal parameters by optimization (periods, thresholds, etc.). I do not expect to get the same results in the future, but I prefer to use the optimized values rather than some arbitrary values. For example everyone may use 12,26,9 for their MACD but if 10,22,8 give better results in backtesting them it'd be better to use that right?

My question is this: I'm now working on combining these 3 into one signal (short, flat, long). I've tried two different approaches to do this:

1 - I use the optimal parameters that I determined on each indicator individually

2 - I re-optimized all parameters together.

#1 seems to be more realistic, with the acknowledgment that the performance will not be the same as the backtests, due to the performance of each system not being the same. This I know. So the final results will probably not be as good. But this seems robust.

#2 - Seems to be more optimal, with an even stronger acknowledgment that the results will not be as good as the backtest. However there is a greater risk of curve fitting due to the increased rules and degrees of freedom. In defense of the optimization I will say that lots of attempts produced unacceptable results so I believe that if optimization finds something good say PF > 3.0 then it's very likely to be positive in forward testing even though the PF will most likely be less.

I'm curious what people think about these two approaches. I am currently forward testing both #1 & #2 but since they trade on daily charts and not very often, it will take a while to have something meaningful.

I've developed systems that have held up and systems that have fallen apart. I understand the limitations of backtesting and automation. So I prefer not to debate that but focus on which approach would be best.

Follow me on Twitter Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Diary of a simple price action trader
26 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Tao te Trade: way of the WLD
22 thanks
My NQ Trading Journal
16 thanks
HumbleTraders next chapter
9 thanks
  #2 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009

Hi,
The best approach is Walk Forward. You can try your #1 and #2, each optimize on sertain period of time and then back test it on the next period.

Baruch

Reply With Quote
  #3 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: RTY
Posts: 683 since Jun 2009
Thanks Given: 758
Thanks Received: 787


Cunparis,

I am going with multiple independent MAs.

I also believe keeping track of Close[0] in relationship to each MA is very important.

I am using colored bars in the attached image to easily determine what is going on with each MA in regards to Close[0] and who is agreeing with whom.

No eye strain, easily automated if desired, and programmable to display any situation.

My Thoughts,

RJay

Attached Thumbnails
Click image for larger version

Name:	MultipleMA.JPG
Views:	317
Size:	237.4 KB
ID:	1474  
Reply With Quote
  #4 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093


baruchs View Post
Hi,
The best approach is Walk Forward. You can try your #1 and #2, each optimize on sertain period of time and then back test it on the next period.

Baruch

I've read about this but I've never done it, which is probably why most of my strategies stopped working.

one of my indicators has 500 trades since 2000. I'm going to optimize it for the first 100 trades and then walk it forward the next 100. Then optimize the first 200 and walk it forward the next 100. So I'll have:

0-100 walked 100-200
0-200 walked 200-300
0-300 walked 300-400
0-400 walked 400-500

this will make 4 walk forward tests. I'll compare the results of each walk forward with the same period optimized. I will also compare the optimal values for each test.

Does this sound right?

I'll post the results as I go. Here's the equity curve for the results of the optimization of the entire 9 year period (500 trades).

Attached Thumbnails
Click image for larger version

Name:	equity curve optimizing 500 trades.jpg
Views:	305
Size:	59.6 KB
ID:	1487  
Follow me on Twitter Started this thread Reply With Quote
  #5 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093


RJay View Post
Cunparis,

I am going with multiple independent MAs.

RJay - I think we're talking about different things. I made an indicator, but the indicator uses lookback periods, moving averages, thresholds, etc. It's those that I want to optimize to find the optimal values for my indicator. Just like someone came up with 14,3,3 for stochastic.

Follow me on Twitter Started this thread Reply With Quote
  #6 (permalink)
 
sefstrat's Avatar
 sefstrat 
Austin, TX
 
Experience: Advanced
Platform: NT/Matlab
Broker: Interactive Brokers
Trading: FX majors
Posts: 285 since Jun 2009
Thanks Given: 20
Thanks Received: 768

Technically both of the approaches you describe above are curve fitting =)

Global parameter search (method #2) is a much better approach because a disjoint search does not take into consideration the relationships between the different indicators.

You want to find a 'stable region' of parameters, ie a range of numbers near each other which all give similar performance, that is good curve fitting.

Bad curve fitting is when you find the best set of parameters which may be an outlier in an unstable region, ie it may have high profit now but the likelihood of it continuing to work in the future is lower.

See the attached matlab plots for an illustration of this. The colors represent performance of a strategy based on normalized Sharpe ratio, red means highest sharpe ratio blue is lowest.

You might be tempted to pick a value along the sharp red ridge that runs along Param1=20, but actually a better choice for the long run is one of the flatter red bumps at the back (near Param1=50, Param2 = 225)

The sharpness of the first ridge makes it inherently unstable, think of it just like in real life if you were standing on a sharp peak and it moved a little bit, you would fall off (which in this case results in drawdown) whereas if you are standing on a flatter hill you will not be affected as much if it shifts slightly.

(BTW.. i generated these images but they are of a strategy from a mathworks webinar, if any of you are matlab users you can download the code and webinar from their website)

Attached Thumbnails
Click image for larger version

Name:	heatSurface.png
Views:	296
Size:	461.5 KB
ID:	1496   Click image for larger version

Name:	heatmap.png
Views:	266
Size:	102.1 KB
ID:	1497  
Reply With Quote
  #7 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093

I'm sad to report the walk forward tests weren't that good. I started with 2000-2003 to give me 100 trades. Then I walked forward year by year. The first couple years it did well on the walk forward test. But then around 2007-present it didn't. I can explain that because that's when we went from bull to bear market. So if we figure the bear market started roughly end of 2007, the problem is I don't have enough trades during the bear market. And even then things changed in March when we started the bull market (or bear market rally). And the market direction isn't the only thing that changed, volatility has completely changed over the past few years.

For me this is the hardest part of creating a mechanical system on a daily timeframe. I've spent a lot of hours on this but I'm afraid it's back to the drawing board.

Lesson learned: With two moving averages you can come up with a profitable system using just about any data.

I still think there's some predictive power here but I have to find a way to prove it..

Follow me on Twitter Started this thread Reply With Quote
  #8 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009

Hi,
Sorry it didn't work, but now you know what to do and hopefully next time you will succeed. Don't blame it on bull or bear market. As I understand you have a trend following system, so it should work on both sides.

Baruch

Reply With Quote
  #9 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

cunparis have you looked at "The Evolution & Optimization of Trading Strategies" by Pardo? Interesting chapters on curve fitting vs. optimization.

Out of curiosity what are you using for historical data and in what timeframe? I'm working on range and tick based charts and it would great if I could test more than the last two-three contracts.

Reply With Quote
  #10 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,093



MXASJ View Post
cunparis have you looked at "The Evolution & Optimization of Trading Strategies" by Pardo? Interesting chapters on curve fitting vs. optimization.

Out of curiosity what are you using for historical data and in what timeframe? I'm working on range and tick based charts and it would great if I could test more than the last two-three contracts.

In this case I'm using minute data from 2000 - present, using Tradestation. This is a big problem with zen-fire not having continuous contracts and long history. I have iqfeed for this purpose for NT.

I have read pardo's book and need to reread the parts about walk forward testing. I worked a lot on my system and when it didn't hold up I was very disappointed. so now I'm focusing on non-mechanical trading. One thing I want to do is try my algorithm with other data sources and that should be interesting. if they can be curve fitted than anything can. if they cannot then maybe my original idea was on to something.

Follow me on Twitter Started this thread Reply With Quote




Last Updated on December 7, 2009


© 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