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

Custom EMA with Decay Factor



PureBytes Links

Trading Reference Links

Could you check out this code, to see if I have satisfied the calls. I
have included the excel spreadsheet with the formulas.

Also, does this custom EMA warrant any discussion, This is the first
time I have seen a Decay Factor added.
Maybe Dimitri can evaluate.

Thank you
Anthony

/* 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)+")";
Attachment:
xls00004.xls

Attachment: Description: "Description: MS-Excel spreadsheet"