PureBytes Links
Trading Reference Links
|
===================
EMA, cycle-adaptive
===================
---8<---------------------------
{ Cycle-adaptive Exponential Moving Avg v1.1 }
{ EMA periodicity determined by historical
price cycle based on ZigZag cycles }
{ ©Copyright 2004 Jose Silva }
{ http://users.bigpond.com/prominex/pegasus.htm }
pr:=Input("ZigZag cycle reversal %",0,100,5);
choose:=Input("EMA periods based on: [1]Cycle, [2]Cycle Avg",1,2,1);
multi:=Input("EMA periodicity: Cycle/Avg length x",.1,100,2);
x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,6);
shift:=1+Input("EMA vertical shift %",
-100,100,0)/100;
plot:=Input("[1]EMA [2]Signals [3]Cycle [4]CyAvg [5]CyStdDev",1,6,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
zz:=Zig(x,pr,%);
zzpk:=Ref(zz,-1)>zz AND Ref(zz,-1)>Ref(zz,-2);
zztr:=Ref(zz,-1)<zz AND Ref(zz,-1)<Ref(zz,-2);
PkTr:=zzpk OR zztr;
CycleLen:=PkTr*(Ref(BarsSince(PkTr),-1)+1);
CycleCount:=Cum(PkTr)-1;
CycleCount:=If(CycleCount=0,.000001,CycleCount);
CycleLenAvg:=Cum(CycleLen)/CycleCount;
pds:=If(choose=1,ValueWhen(1,CycleLen>0
AND CycleCount>0,CycleLen),CycleLenAvg)*multi;
Init:=CycleCount=1 AND Alert(CycleCount<1,2);
pds:=
If(pds>BarsSince(Init),BarsSince(Init),pds);
pds:=If(pds<1,1,pds);
Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
Ema:=Ema*shift;
signals:=Cross(x,Ema)+-Cross(Ema,x);
If(plot=1,Ema,If(plot=2,signals,
If(plot=3,CycleLen,
If(plot=4,CycleLenAvg,
If(plot=5,Stdev(CycleLen,21),pds)))))
---8<---------------------------
jose '-)
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/BefplB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|