Building Your Own Trading System – Part 3
In the last article in this series, I discussed how most trading systems are based around separating trading signals from noise. I talked about using loess smoothing, an advanced smoothing algorithm that smooths more effectively than moving averages. Previously, I discussed identifying some realistic trading goals for the small trader.
This article will build on the article about smoothing, and bring together the goals and smoothing approaches and we’ll explore how to convert these into actual trading rules for a simple trading model.
When you are building a trading system, it is always tempting to look at how it performs against your backtesting data, find some problems, and add special rules to overcome these problems. Another variation of the same approach is to put a lot of variables in your trading model, and keep tweaking them until you have a “perfect” system.
The problem with this is that your trading model will be “curve fitted”. This means that the performance against data used for backtesting will not align with real world performance. The reason for this is mathematical. There is a mathematical approach called a linear regression. This involves fitting an equation to a series of observations. If you add extra variables, you can get the equation to fit very well, but it loses its predictive ability. So a better model with less variables, or in our case, trading rules, is always more robust than a model with lots of variables. Our goal is to build a system with very simple rules.
This system is a long term system, so will be in the market most of the time. It uses end of day data, with trades placed after this point. This is how it will work:
Smooth data (using Loess smoothing)
- If the smoothed data at t > smoothed data at t -1 then
- - if there is an open short position, then close it and open a new long position
- - if there is an open long position, then do nothing
- - if there are no open positions, then open a long position
- If the smoothed data at t < smoothed data at t -1 then
- - if there is an open long position, then close it and open a new short position
- - if there is an open short position, then do nothing
- - if there are no open positions, then open a short position
- If the marked to market loss (this is the difference between the entry price and current price) > stop loss figure, then close the position
So there are two variables in this system:
- Alpha – the loess smoothing coefficient
- Stop loss – the point at which a position is closed without entering a new position.
One possible refinement is to make the stop loss volatility based. To do this, you would calculate true range, and use a multiplier rather than a fixed stop loss figure.
This is a very simple trading system, but backtesting shows that it works quite well. How do you find values of these two variables? I use a genetic algorithm to explore the problem space. I will provide more information on this in the future.
I also have a more advanced model, and will discuss how this works in a future article.

January 8th, 2009 at 8:08 pm
What kind of instruments are you trading and what kind of returns and volatilities are you seeing?
January 10th, 2009 at 9:08 am
At present, I’m out of the market. Previously, primarily ASX traded stocks and currencies. My annual return was about 20% per annum, with peak to valley drawdown of about 5%.