PureBytes Links
Trading Reference Links
|
EMA based on pivotal troughs/peaks, support/resistance.
With multiple output choice.
jose '-)
=============
EMA - pivotal
=============
---8<---------------------------
{ Pivotal Exponential Moving Average v1.0 }
{ EMA based on trough/peak support/resistance }
{ Options:
[1] Composite EMA: (Upper+Lower)/2;
[2] Upper EMA band based on peaks;
Lower EMA band based on troughs;
[3] EMA shifts to Upper/Lower on crossovers }
{ ©Copyright 2004 Jose Silva }
{ http://users.bigpond.com/prominex/pegasus.htm }
pds:=Input("EMA periods",1,2520,21)/2;
plot:=Input("EMA: [1]Composite, [2]Upper/Lower, [3]Long/Short",1,3,
1);
spread:=Input("Upper/Lower EMA bands shift %",
0,100,2)/200;
x:=Input("use: [1]Close, [2]High/Low, [3]P",
1,3,1);
xpk:=If(x=1,C,If(x=2,H,P));
pk:=xpk<Ref(xpk,-1) AND Ref(xpk,-1)>Ref(xpk,-2);
pkVal:=ValueWhen(1,pk,Ref(xpk,-1));
xtr:=If(x=1,C,If(x=2,L,P));
tr:=xtr>Ref(xtr,-1) AND Ref(xtr,-1)<Ref(xtr,-2);
trVal:=ValueWhen(1,tr,Ref(xtr,-1));
pkpds:=If(pds>Cum(pk),Cum(pk),pds);
pkpds:=If(pkpds<1,1,pkpds);
pkEma:=pkVal*2/(pkpds+1)+PREV*(1-2/(pkpds+1));
pkEma:=pkEma*(1+spread);
trpds:=If(pds>Cum(tr),Cum(tr),pds);
trpds:=If(trpds<1,1,trpds);
trEma:=trVal*2/(trpds+1)+PREV*(1-2/(trpds+1));
trEma:=trEma*(1-spread);
Ema:=(pkEma+trEma)/2;
LngShtEma:=If(C>=Ema,trEma,pkEma);
If(plot=1,Ema,If(plot=2,trEma,LngShtEma));
If(plot=1,Ema,If(plot=2,pkEma,LngShtEma))
---8<---------------------------
------------------------ 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/zMEolB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Metastockusers/
<*> To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|