PureBytes Links
Trading Reference Links
|
Jose,
Thanks for sharing this...a very interesting concept.
The Forum Dll that you used is a newer version than the one we have
in our files section. In order to use the one in our files section
the term "DLL" must be added to the variable ExtFml name...
example: pkEma:=ExtFml("Forum.VarMOV",pkVal,pds,e);
change to: pkEma:=ExtFml("ForumDLL.VarMOV",pkVal,pds,e);
or just go to the Equis Forum site and obtain the newer version.:-)
Preston
--- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva"
<josesilva22@xxxx> wrote:
>
> Below is a relatively new type of Exponential Moving Average (EMA),
> based on price, modulated by price peaks/troughs.
>
> Basically, the Pivotal EMA (PEMA) generally hugs the price closer
as
> it approaches market turning points. This can be useful as a
possible
> improvement to the standard EMA in crossover stops.
>
> The first PEMA version uses the standard PREV functions to
construct
> the EMA. The second plots much faster thanks to the use of variable-
> period DLLs.
>
>
> MetaStock -> Tools -> Indicator Builder -> New ->
> Copy and paste complete formulae between "---8<---" lines.
>
> =============
> EMA - pivotal
> =============
> ---8<------------------------------------
>
> { Pivotal Exponential Moving Average v1.0 }
>
> { PEMA 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~2005 Jose Silva.
> The grant of this license is for personal use
> only - no resale or repackaging allowed.
> All code remains the property of Jose Silva.
> http://www.metastocktools.com }
>
> { User inputs }
> 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",1,2,1);
>
> { Peak/Troughs }
> xpk:=If(x=1,C,H);
> pk:=xpk<Ref(xpk,-1) AND Ref(xpk,-1)>Ref(xpk,-2);
> pkVal:=ValueWhen(1,pk,Ref(xpk,-1));
> xtr:=If(x=1,C,L);
> tr:=xtr>Ref(xtr,-1) AND Ref(xtr,-1)<Ref(xtr,-2);
> trVal:=ValueWhen(1,tr,Ref(xtr,-1));
>
> { Peak-based EMA }
> 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);
>
> { Trough-based EMA }
> 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);
>
> { Composite EMA }
> Ema:=(pkEma+trEma)/2;
> LngShtEma:=If(C>=Ema,trEma,pkEma);
>
> { Plot on price chart }
> If(plot=1,Ema,If(plot=2,trEma,LngShtEma));
> If(plot=1,Ema,If(plot=2,pkEma,LngShtEma))
>
> ---8<------------------------------------
>
>
>
> ==========================
> EMA - pivotal, dll version
> ==========================
> ---8<------------------------------------
>
> { Pivotal Exponential Moving Average v.dll
> - Plots much faster than PREV-based version.}
>
> { PEMA 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 }
>
> { Forum.dll from http://forum.equis.com
> or ASI.dll from http://www.thedml.com
> must be in:
> ...\MetaStock\External Function DLLs\ folder.}
>
> { ©Copyright 2004~2005 Jose Silva.
> The grant of this license is for personal use
> only - no resale or repackaging allowed.
> All code remains the property of Jose Silva.
> http://www.metastocktools.com }
>
> { User inputs }
> 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",1,2,1);
>
> { Peak/Troughs }
> xpk:=If(x=1,C,H);
> pk:=xpk<Ref(xpk,-1) AND Ref(xpk,-1)>Ref(xpk,-2);
> pkVal:=ValueWhen(1,pk,Ref(xpk,-1));
> xtr:=If(x=1,C,L);
> tr:=xtr>Ref(xtr,-1) AND Ref(xtr,-1)<Ref(xtr,-2);
> trVal:=ValueWhen(1,tr,Ref(xtr,-1));
>
> { Peak-based EMA }
> pkpds:=If(pds>Cum(pk),Cum(pk),pds);
> pkpds:=If(pkpds<1,1,pkpds);
> {pkEma:=ExtFml("Forum.VarMOV",pkVal,pds,e);}
> pkEma:=ExtFml("ASI.EMA",pkVal,pds);
> pkEma:=pkEma*(1+spread);
>
> { Trough-based EMA }
> trpds:=If(pds>Cum(tr),Cum(tr),pds);
> trpds:=If(trpds<1,1,trpds);
> {trEma:=ExtFml("Forum.VarMOV",trVal,pds,e);}
> trEma:=ExtFml("ASI.EMA",trVal,pds);
> trEma:=trEma*(1-spread);
>
> { Composite EMA }
> Ema:=(pkEma+trEma)/2;
> LngShtEma:=If(C>=Ema,trEma,pkEma);
>
> { Plot on price chart }
> If(plot=1,Ema,If(plot=2,trEma,LngShtEma));
> If(plot=1,Ema,If(plot=2,pkEma,LngShtEma))
>
> ---8<------------------------------------
>
>
> jose '-)
> http://www.metastocktools.com
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/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/
|