Sabtu, 05 Mei 2007

Moving Average Crossover = Triangle Filter On 1-Period Returns

Many traders who job technical analysis favor the Moving Average Crossover every bit a momentum indicator. They compute the short-term minus the long-term moving averages of prices, as well as conk long if this indicator simply turns positive, or conk brusque if it turns negative. This seems intuitive enough. What isn't obvious, however, is that MA Crossover is nix to a greater extent than than an gauge of the recent average chemical compound return.

But simply when yous mightiness hold upward tempted to ditch this indicator inwards favor of the average chemical compound return, it tin hold upward shown that the MA Crossover is likewise a triangle filter on the 1-period returns. (A triangle filter inwards signal processing is a laid of weights imposed on a fourth dimension serial that increases linearly amongst fourth dimension upward to around point, as well as and then decreases linearly amongst fourth dimension upward to the acquaint time. See the diagram at the terminate of this article.) Why is this interpretation interesting? That's because it leads us to consider other, to a greater extent than sophisticated filters (such every bit the to the lowest degree square, Kalman, or wavelet filters) every bit possible momentum indicators. In collaboration amongst my erstwhile workshop player Alex W. who was inspired past times this paper by Bruder et. al., nosotros acquaint the derivations below.

===

First, Federal Reserve annotation that nosotros volition compute the moving average of log prices y, non raw prices. There is of class no loss or hit inwards data going from prices to log prices, but it volition brand our analysis possible. (The exact fourth dimension of the crossover, though, volition depend on whether nosotros job prices or log prices.) If nosotros write MA(t, n1) to announce the moving average of n1 log prices ending at fourth dimension t, as well as then the moving average crossover is MA(t, n1)-MA(t, n2), assuming n1< n2.  By definition,

MA(t, n1)=(y(t)+y(t-1)+...+y(t-n1+1))/n1
MA(t, n2)=(y(t)+y(t-1)+...+y(t-n1+1)+y(t-n1)+...+y(t-n2+1)/n2

MA(t, n1)-MA(t, n2)
=[(n2-n1)/(n1*n2)] *[y(t)+y(t-1)+...+y(t-n1+1)] - (1/n2)*[y(t-n1)+...+y(t-n2+1)]    
=[(n2-n1)/n2] *MA(t, n1)-[(n2-n1)/n2]*MA(t-n1, n2-n1)
=[(n2-n1)/n2]*[MA(t, n1)-MA(t-n1, n2-n1)]

If nosotros translate MA(t, n1) every bit an approximation of the log cost at the midpoint (n1-1)/2 of the fourth dimension interval [t-n1+1, t], as well as MA(t-n1, n2-n1) every bit an approximation of the log cost at the midpoint (n2-n1-1)/2 of the fourth dimension interval [t-n1, t-(n2-n1)], as well as then [MA(t, n1)-MA(t-n1, n2-n1)] is an approximation of the total provide over a fourth dimension catamenia of n2/2. If nosotros write this total provide every bit an average chemical compound growth charge per unit of measurement r multiplied past times the catamenia n2/2, nosotros get

MA(t, n1)-MA(t, n2)  ≈ [(n2-n1)/n2]*(n2/2)*r

r ≈ [2/(n2-n1)]*[MA(t, n1)-MA(t, n2)]

every bit shown inwards Equation iv of the newspaper cited above. (Note the roles of n1 as well as n2 are reversed inwards that paper.)

===

Next, nosotros volition present why the MA crossover is likewise a triangle filter on 1-period returns. Simplifying notation past times fixing t to hold upward 0,

MA(t=0, n1)
=(y(0)+y(-1)+...+y(-n1+1))/n1
=(1/n1)*[(y(0)-y(-1))+2(y(-1)-y(-2))+...+n1*(y(-n1+1)-y(-n1))]+y(-n1)

Writing the returns from t-1 to t every bit R(t), this becomes

MA(t=0, n1)=(1/n1)*[R(0)+2*R(-1)+...+n1*R(-n1+1)]+y(-n1)

Similarly,

MA(t=0, n2)=(1/n2)*[R(0)+2*R(-1)+...+n2*R(-n2+1)]+y(-n2)

So MA(0, n1)-MA(0, n2)
=(1/n1-1/n2)*[R(0)+2*R(-1)+...+n1*R(-n1+1)]
 -(1/n2)*[(n1+1)*R(-n1)+(n1+2)*R(-n1-1)+...+n2*R(-n2+1)]
+y(-n1)-y(-n2)

Note that the final draw inwards a higher house is simply the total cumulative provide from -n2 to -n1, which tin hold upward written as

y(-n1)-y(-n2)=R(-n1)+R(-n1-1)+...+R(-n2+1)

Hence nosotros tin absorb that into the appear prior to that

MA(0, n1)-MA(0, n2)
=(1/n1-1/n2)*[R(0)+2*R(-1)+...+n1*R(-n1+1)]
 -(1/n2)*[(n1+1-n2)*R(-n1)+(n1+2-n2)*R(-n1-1)+...+(-1)*R(-n2+2)]
=(1/n1-1/n2)*[R(0)+2*R(-1)+...+n1*R(-n1+1)]
 +(1/n2)*[(n2-n1-1)*R(-n1)+(n2-n1-2)*R(-n1-1)+...+R(-n2+2)]

We tin encounter the coefficients of R's from t=-n2+2 to -n1 shape the left side of an triangle amongst positive slope, as well as those from  t=-n1+1 to 0 shape the right side of the triangle amongst negative slope. The plot (click to enlarge) below shows the coefficients every bit a part of time, amongst n2=10, n1=7, as well as electrical flow fourth dimension every bit t=0. The right-most signal is the weight for R(0): the provide from t=-1 to 0.


Q.E.D. Now I promise yous are ready to movement on to a wavelet filter!

P.S. It is wonderful to hold upward able to cheque the correctness of messy algebra similar those inwards a higher house amongst a uncomplicated Matlab program!

===
New Service Announcement

Our draw of piece of work solid QTS Capital Management has of late launched a FX Managed Accounts program. It uses i of the mean-reverting strategies nosotros convey been trading successfully in our fund for the final 3 years, as well as is silent going rigid despite the depression volatility inwards the markets. The benefits of a managed concern human relationship are that clients retain total ownership as well as command of their funds at all times, as well as they tin determine what grade of leverage they are comfortable with. Unlike for sure offshore FX operators, QTS is a CPO/CTA regulated past times the National Futures Association as well as the Commodity Futures Trading Commission.

===
Workshops Update

Readers may hold upward interested inwards my adjacent workshop serial to hold upward held inwards London, Nov 3-7. Please follow the link at the bottom of this page for information.

===
Follow me on Twitter: @chanep

Tidak ada komentar:

Posting Komentar