PureBytes Links
Trading Reference Links
|
Thanks Dimitri, after applying your code, and comparing the values, ( see the
attached image ), they are the same . I guess I took the long way around to
achieve the same results. This was some code that I happened upon and
thought maybe it needed some insight.
Will Discontinue with this Direction.
Thank you, very much.
Anthony
DIMITRIS TSOKAKIS wrote:
> Anthony,
> If I read verbatim what you write
> "applying a Decay Factor to Exponential Moving Averages"
> you speak about an EMA of an EMA.
> Example
>
> graph0=EMA(C,10);
> GRAPH1=EMA(EMA(C,10),10);
>
> Is this the smoothing that you search ?
>
> >From the beginning of the code
> Decay=(1-smooth);
> P=C;
> P1=p;
> Avg2=(Smooth*p)+(Decay*p1);
> I notice that
> Avg2=smooth*p+decay*p1=smooth*p+(1-smooth)*p1=
> =smooth*p+p1-smooth*p1=
> =smooth*C+C-smooth*C=C
> Do you need this result, Avg2=C ?
>
> DT
>
> --- In amibroker@xxxx, Anthony Faragasso <ajf1111@xxxx> wrote:
> > Dimitri;
> >
> > Thank you for the reply and direction.
> >
> > Question: Have you heard of applying a Decay Factor to Exponential
> Moving
> > Averages.
> >
> > Period(N) Smooth Decay
> > 8
> > Formulas: =2/(Period+1) =1-Smooth
> >
> > =(Smooth*Close)+(Decay*EMA.PREV)
> >
> > Glossary:
> >
> > SMA:n - Simple Moving Average of the last n values. The first n-1
> value of
> > the average are invalid because there are not enough values to
> produce an
> > answer.
> > EMA:n - Exponential Moving Average
> > Period - (n) the number of days in the moving averages. The period
> may be
> > varied by changing the value in cell R2C6 - the graph and the
> results will
> > change automatically.
> > Smooth - Smoothing factor for an exponential moving average. Factor
> is
> > dreived from the period of an equivalent simple moving average
> needed to
> > achieve the same amount of lag. This factor is multiplied by the
> current
> > source value (SPX in this case).
> > Decay - the decay factor is the one's complement of the smoothing
> factor.
> > This factor is used to weight the previous exponential moving
> average value
> > before they are combined.
> >
> > I have completed some code, maybe you could evaluate, to see if
> this warrants
> > any discussion. Your opinions are valued.
> >
> > Anthony
> >
> > DIMITRIS TSOKAKIS wrote:
> >
> > > Begin at 5119, 5120 and then at 5161 messages of this list.
> > > DT
> > > --- In amibroker@xxxx, Anthony Faragasso <ajf1111@xxxx> wrote:
> > > > Hi Dimitri;
> > > >
> > > > Could you explain how you arrived at the Dbuy and Dsell numbers
> in
> > > your
> > > > formula.Were they produced by doing some optimization, if so,
> could
> > > you
> > > > supply the optimization.
> > > >
> > > >
> > > > /*Slow Stochastic moving buy-sell levels*/
> > > >
> > > > Dbuy=14;
> > > > Dsell=8;
> > > > X1=13;
> > > > MaxGraph=12;
> > > > ST3=StochK(X1);
> > > > ST33=StochD(X1);
> > > > Graph0=ST3;
> > > > Graph1=ST33;
> > > > AVST=MA(StochD(X1),100);
> > > > Graph9=AVST-Dbuy;Graph10=AVST+Dsell;
> > > > Graph8=avst;Graph8Style=8;Graph8BarColor=2;
> > > > Graph9Style=Graph10Style=8;
> > > > Graph9BarColor=Graph10BarColor=1;
> > > >
> > > > Thank you.
> > > > Anthony
> > >
> > >
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> >
> > /* Custom Exponential Moving Average */
> > /* with Decay Factor, coded by Anthony Faragasso*/
> >
> > MaxGraph=8;
> >
> > pds=10; /* Custom EMA periods,and EMA standard, you can change
> period*/
> > pds2=10;/* Simple MA periods , you can change period*/
> >
> > Smooth=(2/(pds+1));
> > Decay=(1-smooth);
> >
> > /* set the P variable: O,H,L,C , your average can be on any price
> variable */
> > P=C;
> >
> > P1=p;
> > Avg2=(Smooth*p)+(Decay*p1);/* this line should read (smooth*p)+
> (decay*ema.prev)*/
> >
> > Avg3=EMA(Avg2,pds);
> >
> > Avg4=(Smooth*p)+(Decay*Ref(Avg3,-1));/* have I satisfied that line
> Here*/
> >
> > Graph0=EMA(Avg4,pds);
> > Graph0Color=6;
> > Graph0Style=1; /* blue line , Custom EMA with Decay*/
> >
> > Graph2=C;
> > Graph2Style=128;
> >
> > Graph3=MA(p,pds2);
> > Graph3Color=4; /*red line , Simple MA */
> >
> > Graph4=EMA(p,pds);
> > Graph4Color=2; /* white line , EMA standard */
> >
> > Title=Name()+" Custom EMA with Decay :Blue "+"("+WriteVal
> (Graph0,format=1.2)+")"+" EMA :White"+"("+WriteVal(Graph4,format=1.2)
> +")"+" Simple MA :Red "+"("+WriteVal(Graph3,format=1.2)+")"+"
> Close :"+"("+WriteVal(Graph2,format=1.2)+")";
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Attachment:
Description: ""
|