[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


Anthony,
 
This is NOTHING new. I mean EACH exponential moving 
average is calculated this way. 
 
This Decay factor is in fact the STANDARD way of 
calculating EMA:
ema_today = factor * close + ( 1 - factor ) * 
ema_yesterday.
 
your decay factor is (1-factor), when factor = 
2/(Period+1).
 
This is a STANDARD EMA. There is no magic 
here.
 
AFL built in EMA works exactly like 
this.
And as I wrote before AMA function that takes 
factor parameter allows
you to create variable-period exponential moving 
averages that works
again with the same scheme.
 
Best regards,
Tomasz Janeczko
amibroker.com
 
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
Anthony Faragasso 

To: <A 
href="" 
title=amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx 
Sent: Monday, November 12, 2001 12:32 
PM
Subject: Re: [amibroker] Re: Slow 
Stochastic moving buy-sell levels
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 
------------------------ Yahoo! Groups Sponsor 
---------------------~--> Universal Inkjet Refill Kit $29.95 
Refill any ink cartridge for less! Includes black and color ink. 
<A 
href="">http://us.click.yahoo.com/bAmslD/MkNDAA/ySSFAA/dkFolB/TM 
---------------------------------------------------------------------~-> 
    
Your use of Yahoo! Groups is subject to <A 
href="">http://docs.yahoo.com/info/terms/Your 
use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 




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