From the April 2013 issue of Futures Magazine • Subscribe!

Casting neural nets into modern markets

Case study: Moving average crossover

The moving average crossover system is a classic trend-following method. Two popular variations of this strategy are the dual-moving-average system and the triple-moving-average crossover. 

Here’s the code for a simple dual-moving-average crossover system: 

Sub DualMACrossover(SLen As Integer,LLen As Integer)

 Dim ShortAve As BarArray

 Dim LongAve As BarArray

 ShortAve = Average(Close, SLen,0)

 LongAve = Average(Close, LLen,0)

 If ShortAve > LongAve Then

 Buy(“BuyEnt”,1,0,Market,Day)

 End If

 If ShortAve <LongAve Then

 Sell(“SellEnt”,1,0,Market,Day)

 End If 

End Sub

This is a simple trend-following system that has some problems. First, if the short-term moving average is half of the dominant cycle, and the long-term moving average is a full dominant cycle, basic cycle theory says we are 180% out of phase, meaning regardless of how well the system does at other times, we will buy every top and will sell every bottom. This is why a dual-moving-average approach is flawed. It will catch big trends, but it will lose badly when trends are shorter term. 

<< Page 3 of 7 >>
Comments
comments powered by Disqus
Check out Futures Magazine - Polls on LockerDome on LockerDome