Monday, August 25, 2008

The Perils of Curve Fitting

First of all, a warm Thank You for the comments and e-mails and coding posts that followed Occam's Razor and the 3 Finger Lead. It's nice to know that other traders are thinking about these ideas and devising tactics to incorporate them into their trading.
George made a comment about curve fitting that I think is particularly apt. Anybody that's attempted to develop code runs up against this sooner or later and it basically has to do with creating a false probability scenario based on over-optimizing the system variables in order to maximize performance (ROI). The more variables, the greater the possibility that curve fitting will occur.
There are a number of data testing models (and software programs) that can help reduce curve fitting errors. A common method, the walk forward, divides the symbol database into segments that are tested incrementally, usually from latest to most current. Depending on the size of the database (# of bars), I typically divide the database in half, run an optimization test on each half and then set the variables to an average value. I've also got an adaptive algorithm for most oscillators that I can insert in the code to smooth things out as time moves forward. Although 3 Fingers took me about 45 minutes to post, it took over 20 hours of my time to develop, refine, test, refine, retest, refine, retest, etc..... Hey! . . . I'm old, things take a little longer.
Keep in mind that, as a daytrader, I use these system to build a consensus of momentum and to gauge probability of the daily cycle. Studies like Expiration, Cheaphooker and Monthly End Tickler are date based systems and I may take multi-day positions on these, if all the signals align.
I tend to think of these systems not with the danger of curve fitting, but with the advantage of reverse engineering. At the same time I'm always mindful of the markets' tendency to mean reversion (per my 3 Linear Regression studies) and although the markets may make significant trend moves, there will always be some retracements back to the mean (or below) along the way.
I posted 3 Finger Lead as a jumping off point for further trend following studies and will make an effort to identify possible curve fitting dangers in the system logic for future permutations. This blog is a work in progress, and those who have followed my twisted path over the past year have seen the theme and focus of the posts change considerably. I hope to get in a few more burps before I'm done.
Anyone wanting to pursue system trading ideas further can check out www.futurestruth.com, a site I have mentioned several times before and for which I have the highest respect, but no connection. A lot of free stuff here, although for committed systems traders, and would-be auto traders, the magazine is the value of the century. Check out the top 10 systems. . . some of these have been making consistent money for years, suggesting that curve fitting is probably not one of their characteristics.

6 comments:

LP said...

Good Post. Good to know that you keep the whole walk forward thing in mind while you develop these systems.

I have come across many of these types of blogs, however, only yours and Rob's blogs are in my reader. I've chosen to only follow the two of you because of your simplicity and the fact that you don't talk down to your readers.

Keep up the great work.

GS751 said...

Great post. "The more variables, the greater the possibility that curve fitting will occur." - To me this is 100% true. The reason I don't trade technicals very much is I don't feel that I can design a system that is robust enough for curve fitting.

"markets' tendency to mean reversion" - I would say I have to agree and disagree, lol, mean revision towards what? I find that I have to be careful how far I take the bell curve. Long Term Capital management made the markets too efficient, and a variable occurred that their model could not hedge (e.g. Russia's default). Don't get me wrong LTCM could have killed, if they had not gotten so big and became the market. I personally find it easier to look to mean revision in volatility rather than in price action, but both variables that are depended on each other (not sure if that is making sense).

bzbtrader said...

George,
You're right about mean reversion.
My use of mean reversion is focused mostly on the 3 linear regression channels (30,11&3) that I use for the weekly Qs Updates (currently suspended). I adapted the 3 LRs study from Richard Muehlberg's (link in Sites of Interest) and have found the 3LRS study useful in gauging short term momentum. Richard uses the 3 LRs to daytrade a basket of futures, apparently with considerable success.

GS751 said...

You ever thought about combing that with some correlations? The only thing with correlations I have to be careful is the fundamental theorem of statistics, correlation does not always equal causation.. A lot of people have been successful currency traders with them.

bzbtrader said...

George,
I've been working on the 3LRs thing for months in conjunction with another trader. The model is a work in progress and when completed I will submit to futurestruth for testing.

GS751 said...

I wish you the best of luck with your model and let me know how it ends up.