AFL Sine weighted moving average

#1
Hi everbody

Can any senior give me ALF for the following Indicator


Sine-Wave Weighted Moving Average

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*S D);
Num/Den


Many Thanks in advance

Paciffic
 

KelvinHand

Well-Known Member
#2
Re: ALF Sine weighted moving average

Hi everbody

Can any senior give me ALF for the following Indicator


Many Thanks in advance

Paciffic
_SECTION_BEGIN("SinWMA");
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);
SinWMA =Num/Den;

Plot(SinWMA, "SinWMA", colorBlue);
_SECTION_END();
 
Last edited:

hitesh

Active Member
#3
Re: ALF Sine weighted moving average

Hi everbody

Can any senior give me ALF for the following Indicator


Sine-Wave Weighted Moving Average

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*S D);
Num/Den


Many Thanks in advance

Paciffic
I have this version
The difference is in SD (180/7)

///////// Sine Weighted MA

P = ParamField("Price field",-1);

PI=3.1415926;
SD=180/7;
S1=sin(1*sd)*p;
S2=sin(2*sd)*Ref(p,-1);
S3=sin(3*sd)*Ref(p,-2);
S4=sin(4*sd)*Ref(p,-3);
S5=sin(5*sd)*Ref(p,-4);
S6=sin(6*sd)*Ref(p,-5);

Num=S1+S2+S3+S4+S5+S6;
Den=sin(SD)+sin(2*SD)+sin(3*SD)+sin(4*SD)+sin(5*SD)+sin(6*SD);
SineMA=Num/Den;
Colr=IIf(SineMA > Ref(SineMA,-1), colorBrightGreen,colorRed);
Plot(SineMA,"sine",colr,styleThick);
 

Similar threads