Thursday, September 25, 2008

Crude approaches | ForexGen

I would like to describe two crude noise filters: the breakout and the moving average (and its variants).

The breakout is an entry or exit signal that is triggered when the current price exceeds (e.g.) a 20 day high, or falls below a 20 day low. The parameters that can be tweaked are the number of periods and the amount by which the price must exceed or be below the high or low.

The way that this works to filter noise is through a volatility filter. In effect, the system attempts to remove price volatility attributable to noise and assumes that a price that exceeds a certain level represents a true signal rather than noise.

This is how a breakout can be described in an algorithm:

If price + trigger amount > high of n periods then buy
If price - trigger amount <>

The problem is that this approach is rather well known, and false breakouts are therefore quite common. This means that the noise from traders entering the market now distorts the signal.

Another approach is a moving average. This is simply the average of the last (say) 20 periods. The result will be a smoother line than the original price series, but lagged by about 1/2 the period selected. A longer number of periods produces a smoother line, but with more lags to price action, while a shorter number of periods produces a less smooth line which reflects more noise, but is more responsive to changes.

A moving average removes noise by reducing the impact of a particular noisy value by averaging it out. Because this is an average, it is still subject to distortion by extreme values, so it doesn’t work well if you have very noisy data, unless you choose a very long moving average period, which causes lags.

The algorithm for a moving average (n period, where n is an integer, e.g. 20) is as follows:

Sum last n periods, then divide by n
Move forward 1 period, then recalculateThe moving average needs to be combined with some other rules for a complete trading system. For example, one popular approach is to look at when 20 period and 50 period moving averages cross over:If 20 day moving average crosses over 50 day moving average then buy
If 20 day moving average crosses below 50 day moving average then sellThere are some variants to this such as exponential moving averages and median filters. The exponential moving average has similar properties to the usual type but is calculated differently, so I won’t go into detail here. A median filter is more interesting. This has less lag. The algorithm is:Sort last n periods of price data from highest to lowest
Take the middle point
Use this as the valueMedian filters can be used in a similar way to ordinary moving averages. They remove noise by excluding extreme values and looking at the value in the middle.All these algorithms can be easily implemented in Excel.Next time, I’ll continue this in more detail and begin to discuss some of the more advanced techniques also.


If you are an experienced ‘FOREX’ Trader or just a beginner looking for the opportunities offered in the ‘FOREX’ market, Forexgen has created ForexGen Academy to give you the chance to get a ‘FOREX’ education and improve your trading skills.
No hard expressions, no buzz words, and no rocket science language are used throughout these lessons.

No comments: