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

Re: [amibroker] Re: Slow Stochastic moving buy-sell levels



PureBytes Links

Trading Reference Links

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/

--------------C8BCC6C307B1C83D5C14F20C
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Dimitri;
<p>Thank you for the reply and direction.
<p><b>Question:&nbsp;</b> Have you heard of applying a Decay Factor to
Exponential Moving Averages.
<p><b>Period(N)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Smooth&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Decay</b>
<br>&nbsp;&nbsp;&nbsp;&nbsp; <b>8</b>
<br><b>Formulas:</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>
=2/(Period+1)</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>
=1-Smooth</b>
<p><b>&nbsp;=(Smooth*Close)+(Decay*EMA.PREV)</b><b></b>
<p><b>Glossary:</b>
<p><b>SMA:n </b>- 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.
<br><b>EMA:n </b>- Exponential Moving Average
<br>Period - (n) the number of days in the moving averages.&nbsp; The period
may be varied by changing the value in cell R2C6 - the graph and the results
will change automatically.
<br><b>Smooth</b> - 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).
<br><u><b>Decay</b> </u>- the decay factor is the one's complement of the
smoothing factor.&nbsp; This factor is used to weight the previous exponential
moving average value before they are combined.
<p>I have completed some code, maybe you could evaluate, to see if this
warrants any discussion. Your opinions are valued.
<p>Anthony
<p>DIMITRIS TSOKAKIS wrote:
<blockquote TYPE=CITE>Begin at 5119, 5120 and then at 5161 messages of
this list.
<br>DT
<br>--- In amibroker@xxxx, Anthony Faragasso &lt;ajf1111@xxxx> wrote:
<br>> Hi Dimitri;
<br>>
<br>> Could you explain how you arrived at the Dbuy and Dsell numbers in
<br>your
<br>> formula.Were they produced by doing some optimization, if so, could
<br>you
<br>> supply the optimization.
<br>>
<br>>
<br>> /*Slow Stochastic moving buy-sell levels*/
<br>>
<br>> Dbuy=14;
<br>> Dsell=8;
<br>> X1=13;
<br>> MaxGraph=12;
<br>> ST3=StochK(X1);
<br>> ST33=StochD(X1);
<br>> Graph0=ST3;
<br>> Graph1=ST33;
<br>> AVST=MA(StochD(X1),100);
<br>> Graph9=AVST-Dbuy;Graph10=AVST+Dsell;
<br>> Graph8=avst;Graph8Style=8;Graph8BarColor=2;
<br>> Graph9Style=Graph10Style=8;
<br>> Graph9BarColor=Graph10BarColor=1;
<br>>
<br>> Thank you.
<br>> Anthony
<p>------------------------ Yahoo! Groups Sponsor ---------------------~-->
<br>Universal Inkjet Refill Kit $29.95
<br>Refill any ink cartridge for less!
<br>Includes black and color ink.
<br>http://us.click.yahoo.com/bAmslD/MkNDAA/ySSFAA/dkFolB/TM
<br>---------------------------------------------------------------------~->
<br>&nbsp;
<br>&nbsp;
<p>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/</blockquote>
</html>

--------------C8BCC6C307B1C83D5C14F20C--

/* 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)+")";