PureBytes Links
Trading Reference Links
|
In the June 99 issue of TASC there is an article written
by Patrick E. Lafferty named:
"How Smooth Is Your Data Smoother?". This article
compares different types of moving averages and he
describes one he calls a "Sine-Weighted Moving Average".
Below I have posted the code that was provided for MetaStock,
but I have few questions about it........why did they define the
variable named "PI"? I know what PI is, but the code never "calls"
this variable. Also I wonder why there is no option to choose
the look-back period.....this code is only a 5 day average.
Anywise here is the code:
{Sine-Weighted Moving Average
by Cheryl Elton,Equis International}
PI:=3.1415926;
SD:=180/6;
S1:=Sin(1*180/6)*C;
S2:=Sin(2*180/6)*Ref(C,-1);
S3:=Sin(3*180/6)*Ref(C,-2);
S4:=Sin(4*180/6)*Ref(C,-3);
S5:=Sin(5*180/6)*Ref(C,-4);
Num:=S1+S2+S3+S4+S5;
Den:=Sin(SD)+Sin(2*SD)+Sin(3*SD)+Sin(4*SD)+Sin(5*SD);
Num/Den
Best wishes,
Adam Hefner.
VonHef@xxxxxxxxxxxxx
---------------------------------------
|