Wednesday, January 12, 2011

Building a Trading System: Part 7–Optimization

So far in this series we have been able to wrangle together a very basic trading system based on mean-reversion, and improve it through a simple trend filter and volatility filter.  I’ve said repeatedly that this is not a recommended strategy, nor do I trade with this strategy.  It’s simply meant to share some basic processes for building a trading system. 

From where we are you could do many things.  Perhaps you want to place liquidity filters in place to make sure you are not dealing in thinly traded equities.  There are an infinite number of possibilities, but the basic idea is the same… come up with a set of rules to define when and what you want to trade.

What is Optimization?

Once a solid set of rules is defined we have a chance to optimize the system.  This simply means that we can find the best “settings” or “parameters” for our rules.  For example, we have a basic trend filter built on a 200-day moving average.  Why 200?  Why not 100? Or 50? 

Amibroker provides excellent tools for optimizing these settings. It allows you to plug in a range of settings, and then it checks them all to find the best one.  For example, I might test all moving averages between 50 and 300 to see which performs best.  Most testing software has a function like this, which makes it a speedy process to optimize the system. 

We can even find the optimal settings for multiple parameters at the same time.  In the next post I’ll give you an example using our system.  We’ll run an optimization back-test for the moving average trend filter, AND the distance from the 5-day moving average.  Remember that our basic rule is to buy when the price is stretched more than 5% lower than the 5-day MA.  But why 5%? Why not 6%, or 4%?  Stay tuned to see what works best.

Good Trading…

No comments:

Post a Comment