0% found this document useful (0 votes)
168 views14 pages

Optimization Without Curve Fitting v100

Curve fitting, or over-optimizing a trading system, can give false hope that the system will be profitable when traded live. To avoid over-fitting: 1. Divide historical data into in-sample and out-of-sample sets to test the system on unseen data. Do not tweak the system using out-of-sample results. 2. When optimizing parameters like moving average periods, do not simply choose the best performer. Look for a stable range of values that produce similar results to test the parameter's robustness. 3. Too many parameters, using out-of-sample data to tweak the system, or selecting only the best optimized parameters can all lead to over-fitting and

Uploaded by

Roberto Krieger
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
168 views14 pages

Optimization Without Curve Fitting v100

Curve fitting, or over-optimizing a trading system, can give false hope that the system will be profitable when traded live. To avoid over-fitting: 1. Divide historical data into in-sample and out-of-sample sets to test the system on unseen data. Do not tweak the system using out-of-sample results. 2. When optimizing parameters like moving average periods, do not simply choose the best performer. Look for a stable range of values that produce similar results to test the parameter's robustness. 3. Too many parameters, using out-of-sample data to tweak the system, or selecting only the best optimized parameters can all lead to over-fitting and

Uploaded by

Roberto Krieger
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

SYSTEM TRADER SUCCESS VERSION

2 1.0

Introduction
As youre well aware, curve fitting is a danger that all system developers must
constantly be aware of. Curve fitting not only destroys your trading system, but can give you
false hope that your system will work on the livemarket which results in you losing your
hard earned money.Curvefitting often hitsnovice system developers without them even
knowing about it. This can be particularly confusing anddisheartening. But it can creep into
the development process of professional developers.Itsyour job to be aware of curve fitting
and how to avoid it.

I wrote this guide to help you better understand how to avoid curve fitting in your
system developmentendeavors. Now, with thisinformation, you can make an informed,
intelligent decision. If you have any questions about system trading, youre invited to ask us
at:questions@systemtradersuccess.com. Weve dedicated our business to educating the retail
trader just like you. Well be happy to help in everyway we can.

HOW TO AVOID OVER-OPTIMIZING PAGE2


SYSTEM TRADER SUCCESS VERSION
3 1.0

The Problem
Finding Patterns Within The Noise

Curve fitting may not be the best term to use here. Curve fitting
from amathematical standpoint isattempting to fit aline or curve
through a series of data points. Thats not what we are doing with a
trading system.When it comes to trading, we areattempting to
optimize a trading systems performance. Often this is a key
performance metric, such as net profit. We do this by attempting to
optimize various parameters in an attempt tomaximize profits. Of
course, one single metric is not all we look at whenattempting to optimize a system. We take
into account many different performancemetrics such asprofit factor, drawdown, and
average profit per trade, to name a few, to help us gauge if a particular system is tradable or
not.

When it comes to making a profitable trading system we depend upon finding market
edges we canexploit.All successful tradingrelies onrecurringpatterns found in the
historical market data andexploiting those patterns to make a profit. This is true
fordiscretionarytraders as well as system traders. However, much of the historical market
movement is noise or random movement. So, the problem arises when weover-optimizeour
system to the historical data andunknown to us, our system begins to key-into
patternswithin the noise instead ofexploiting a true market edge. Finding a pattern in the
noise can produce great looking equity curves on historical data, but on out of sample data
the equity curve can break down rather quickly.

In summary, we want a trading system thatexploits a true market edge and avoids
keying-off patterns in the market noise. The idea ofseparating a true market edge from the
noise is what this game is all about.

HOW TO AVOID OVER-OPTIMIZING PAGE3


SYSTEM TRADER SUCCESS VERSION
4 1.0

So how does over-optimizing occur? Its oftenaccomplishedunknowingly as a system


developer continues totweakthe trading system to obtain better results over the historical
market data. Over-optimizing can often occur when:

Using out of sample data to make corrections to a system.


Selecting highly optimizedparametersthat give you the best results.
Having too many parameters.
Performing what I call, Conjunction Optimization.

HOW TO AVOID OVER-OPTIMIZING PAGE4


SYSTEM TRADER SUCCESS VERSION
5 1.0

Step 1:
Proper Use Of In-Sample And Out-of-Sample Data

The first step when developing a trading system is to divide your historical data over
two segments.

1. In-sample segment
2. Out-of-sample segment

This basic step is required for all system development. The in-sample segment should
consist of the bulk of the historical data. Let's say about 80% of your historical data should be
dedicated to this segment. The in-sample segment is the historical data used when
developing your system. Its where all your development decisions are made. During your
development process you never apply your work-in-progress trading system to the out-of-
sample segment. This segment is reserved for testing your final system to see if it can hold up
on historical data it has never seen".

January 1, 2000 January 1, 2011

Out-of-
In-Sample Data Sample
Data

Today

Once your development is done one of the first things you will do is now test the
performance on the out-of-sample segment to see how it performs. Ideally, the system should
perform well as the equity curve advances.

HOW TO AVOID OVER-OPTIMIZING PAGE5


SYSTEM TRADER SUCCESS VERSION
6 1.0

Here is what not to do! Do not take the results of the out-of-sample data and tweak
your trading system in an attempt to improve it. Doing this nullifies the concept of the out-of-
sample segment as being out-of-sample. The idea is the out-of-sample segment is to test your
strategy on "unseen"data. If you go back an start modifying your trading system you have
not tainted the out-of-sample data. Its now in-sample data as you are taking knowledge
based upon the system performance and tweaking the system to make it better!

When your system is applied to the out-of-sample data it either passes or fails. While
its true that mediocre results on the out-of-sample segment may be OK, dont start tweaking
the parameters.

HOW TO AVOID OVER-OPTIMIZING PAGE6


SYSTEM TRADER SUCCESS VERSION
7 1.0

Step 2:
How To Optimize Correctly

Optimizing particular strategy inputs, such as a look-back


period of a moving average crossover system, can be a
strong source of over-optimizing your system. However,
you can significantly reduce the risk by following a few
key points.

1.Dont pick the best. When optimizing a parameter you


dont want to pick the best value.
2. Look for a stable region.
3. Ideally, you want to find a cluster or range of values where your system performs
well.
4. Abandon if all else fails.
5. If a default value looks optimized or not robust, then you may be forced to abandon
the system.

The key to optimizing parameters is something I call robustness in the given parameter
youre optimizing.

Lets say we are attempting to optimize a look-back period for a moving average. Let's
also say the default value is currently 50. When optimizing this value I want to look for two
things. First, if the default value is optimized. Second, if other nearby values produce similar
results. In short, I would like to test the robustness of the look-back period. For example, if
we change the 50-day default value to 49 or 51, I dont want to see the systems equity curve
drastically change. Furthermore, the system should not radically change if I use 47 or 52. The
neighboring values around 50 should still produce positive results and in fact, produce
similar results. In fact, it would be ideal to see the system remain profitable over a wide range
of values.

HOW TO AVOID OVER-OPTIMIZING PAGE7


SYSTEM TRADER SUCCESS VERSION
8 1.0

Below is a bar graph of a look-back period optimization covering the range between 20
- 200. The x-axis contains the look-back period while the y-axis contains the trading system's
total P&L. Remember, our default value was 50 and we want to optimize it.

First, the default value of 50 is far from an optimal value. It appears a wide variety of
look-back values produce positive results. Since we dont want to pick an optimal value, how
do we pick a value? Notice the values starting from 20 climb in net profit as we reach 80 then
level off until they start to climb around 150. Its reasonable to pick a value within this range
of 80 - 150. Often I will pick the midpoint. You can calculate this by adding the values

HOW TO AVOID OVER-OPTIMIZING PAGE8


SYSTEM TRADER SUCCESS VERSION
9 1.0

(80+150) and dividing by two. In this case, the value of 115 would be our new look-back
period.

You could also make the case there is a stable region between 150 - 200. It might be
worth extending the look-back study to see values beyond 200. Picking a midpoint value
within this region is most likely fine as well. It would be worth testing and comparing the
various system performance metrics to see if there is a reason to pick one stable region vs the
other. This might simply come down to a personal preference such as preferring fewer trades.
I wont explore the other regions here in the Ebook as I think you get the picture.
When optimizing a value, you dont simply want to pick the best looking value. Find a
region where the values appear stable. That is, an area with little variation. Once you find
that region, pick a value within the center of that region. Doing this will help reduce over
optimizing your trading system.

HOW TO AVOID OVER-OPTIMIZING PAGE9


SYSTEM TRADER SUCCESS VERSION
10 1.0

Step 3:
Keep It Simple!

Keep in mind that simple is often better. When possible,


keep the number of parameters and trading rules to as
few as possible to accomplish the task. Introducing more
trading rules increases the likelihood of over-optimizing
the system to the historical data. If you introduce a
trading rule to a system, it must have a significant
positive impact on the trading rules in order to justify
keeping it. If the results are deemed mediocre, then
throw out the rule.

For example, lets say a single rule introduced to your


system reduced the number of trades by 1/3 or even 1/2. At the same time the profit factor
increases from 1.07 to 1.50 and the average dollars per winning trade increases from $20 to
$60. To me, this is significant because we reduced the number of trades by removing
unprofitable trades. This may be an exaggerated example, but it could happen. Generating
fewer trades and creating more dollars per trade is usually always a great idea even if the
system is making less net profit. Keep an eye on the drawdown as well. Maybe a rule does
not significantly improve the net profit but does significantly reduce drawdown. This may be
significant and worth keeping. It is true that significant can be subjective. Thats fine
because each of us will have different tolerances to risk, drawdown and what we consider an
acceptable trading system. However, keep in mind if the system does not benefit much from
the rule, you are better to leave it out. A trading system with fewer rules is generally
considered more robust. So when in doubt, leave it out!

HOW TO AVOID OVER-OPTIMIZING PAGE10


SYSTEM TRADER SUCCESS VERSION
11 1.0

Step 4:
The Independent Testing Secret

Following this important step can go a long way in


preventing you from developing a system that is overly
optimized to the historical data. When developing a trading
system its common to apply different filters and stops. For
example, let's say you have a simple moving average
crossover system. You then wish to test a trailing stop and a
trend-strength indicator to filter trades. So we have the
following items to test:

Look-back period of the moving average crossover


Threshold value used on the trend filter
Trailing stop distance

How do you pick values for each of these indicators? How do you optimize your
system? We already know not to pick the best optimization but when you have multiple
items to optimize, how do you go about it? In my opinion you should attempt to perform
independent testing whenever possible. What does that mean? Each new rule that we test
must be done independent of the other rules. While its not always possible to completely do,
it should be done whenever possible.

Lets say we would like to test a trailing stop. After adding the trailing stop to our
baseline system we determine if it improves the performance significantly. We record our
results and move on to test another rule. Lets say we next choose to test a profit target. To
test our profit target rule we must revert back to the baseline system. That is, we do not add
our profit target rule to the system with the trailing stop rule. Our profit target rule must be
applied to the baseline system. Each new rule that we test must be done independent of the
other rules. This is done to avoid over optimization and will help maintain a robust system.

HOW TO AVOID OVER-OPTIMIZING PAGE11


SYSTEM TRADER SUCCESS VERSION
12 1.0

You should also test different entry methods. A limit order at the extreme of the last
three bars vs. market order at the open of the next bar, for example. Follow the same
guidelines when testing exit methods.

HOW TO AVOID OVER-OPTIMIZING PAGE12


SYSTEM TRADER SUCCESS VERSION
13 1.0

CONGRATULATIONS!
Over optimization is always a danger, but if you follow the simple guidelines provided
within this eBook you will be much more effective in reducing the chance of over-optimizing
your trading systems.

Resources:

Curve-fitting and Optimization

For more information visit our website, System Trader Success, for content rich articles
on all aspects of successful system development.

HOW TO AVOID OVER-OPTIMIZING PAGE13


SYSTEM TRADER SUCCESS VERSION
14 1.0

How To Build Profitable Trading Systems

Do you know the proper steps at building profitable trading systems? It's great that you
learned how to use two timeframes, but there is much more to successful system
development. If you liked this technique of using two timeframes, you'll love my ebook on
building profitable trading systems.

It's a complete step-by-step guide or blueprint on the


very steps I use to create profitable trading systems.
If you would like to learn the steps I use to avoid
curve fitting, proper testing and help ensure your
system will work well into the future check out this
link.

Learn More

HOW TO AVOID OVER-OPTIMIZING PAGE14

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy