[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sine Weighted Moving Average



PureBytes Links

Trading Reference Links


Yes, sir...  You're quite right.  The function should use 180/(Length + 1).
I've attached the revised code and listed it below...


User function:

Inputs:
Length(NumericSimple);


Variables:
Counter(0),
Num(0),
Den(0),
Fac(30);

Fac = 180/(Length + 1);
Den=0;
Num=0;

For Counter=1 To Length Begin
 Num=Num+C[Length - Counter]*Sine(Counter*Fac);
 Den=Sine(Counter * Fac)+Den;
End;

If Den<>0 Then AR_SWMA=Num/Den;

*********************************

Indicator:


Input:  Length(5);

Plot1(AR_SWMA(Length), "SWMA");




All the best,

The Omega Man



----- Original Message -----
From: The Omega Man <editorial@xxxxxxxxxxxxx>
To: Omega List <omega-list@xxxxxxxxxx>; King <mking@xxxxxxxx>
Sent: Saturday, June 19, 1999 9:07 AM
Subject: Re: Sine Weighted Moving Average


>
> Yes, sir...  I've attached the .ela file for an indicator called AR -
SWMA.
> In case that indicator will not import for you, here's the code:
>
>
> First, create a user function called AR_SWMA as follows:
>
>
> Inputs:
> Length(NumericSimple);
>
>
> Variables:
> Counter(0),
> Num(0),
> Den(0),
> Fac(180/6);
>
> Den=0;
> Num=0;
>
> For Counter=1 To Length Begin
>  Num=Num+C[Length - Counter]*Sine(Counter*Fac);
>  Den=Sine(Counter * Fac)+Den;
> End;
>
> If Den<>0 Then AR_SWMA=Num/Den;
>
>
> *******************************
>
> Next, create the indicator AR - SWMA as follows:
>
>
> Plot1(AR_SWMA(5), "SWMA");
>
>
>
> All the best,
>
> The Omega Man
>
>
>
>
> ----- Original Message -----
> From: King <mking@xxxxxxxx>
> To: <omega-list@xxxxxxxxxx>
> Sent: Saturday, June 19, 1999 8:33 AM
> Subject: Sine Weighted Moving Average
>
>
> > Has anyone looked at this average discussed in June TASC? I tried to
> > implement the Trader's Tips code in SC 2.1 but got funny results for
> > anything other than an input of 5.
> >
> > The article doesn't explain the SWMA very well, but I wonder if the
factor
> > maybe should be 180/(length + 1) or something like that instead of
180/6?
> > Anyone have any ideas? At my age, my math isn't all that great anymore.
> >
> > David
> >
>
>