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

Re: [EquisMetaStock Group] Re: Breakout-sensitive EMA



PureBytes Links

Trading Reference Links

Chorlton
 
 
All dlls must reside in the "External Function Dlls" folder. The path for dlls is usually something like
 
C:\Program Files\Equis\MetaStock\External Function Dlls\ASI.dll
 
MetaStock must be restarted after a dll is placed in this folder.
 
 
Roy
[url="" Tips & Tools[/url]
 
----- Original Message -----
Sent: Tuesday, November 15, 2005 7:03 AM
Subject: [EquisMetaStock Group] Re: Breakout-sensitive EMA

--- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva"
<josesilva22@x...> wrote:
>
> Below is a Breakout-sensitive Exponential Moving Average (BEMA for
> short).
> It reacts quicker (tightens) on price breakouts, and loosens back
to
> normal progressively thereafter.
>
> Perhaps it should do the opposite, i.e. loosen on breakouts and
> tighten progressively thereafter instead.
>
> Anyway, maybe there is some usefulness in this variable-period EMA.
>
>
> MetaStock -> Tools -> Indicator Builder -> New ->
> Copy and paste complete formulae between "---8<---" lines.
>
>
> ==============================
> EMA - Breakout-sensitive (BEMA)
> ==============================
> ---8<-------------------------------------
>
> { [B]reakout-sensitive [E]xp [M]ov [A]vg v1.0 }
>
> { BEMA based on bars since price breakouts.
>   Options:
>    [1] Composite BEMA: (Upper+Lower)/2;
>    [2] Upper BEMA band based on upside breaks;
>        Lower BEMA band based on downside breaks;
>    [3] BEMA shifts to Upper/Lower on crossovers}
>
> { ©Copyright 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("BEMA and HHV/LLV lookback periods",
>  1,2520,21);
> plot:=Input("BEMA: [1]Composite, [2]Upper+Lower, [3]
Long/Short",1,4,1
> );
> spread:=Input("Upper/Lower BEMA bands shift %",
>  0,100,2)/200;
> x:=Input("Breakouts, use:  [1]Close,  [2]High/Low",1,2,1);
>
> { Upside breakouts }
> xup:=If(x=1,C,H);
> up:=xup=HHV(xup,pds);
>
> { Downside breakouts }
> xdw:=If(x=1,C,L);
> dw:=xdw=LLV(xdw,pds);
>
> { Remove ghost breakout signals }
> init:=Cum(IsDefined(up+dw))=1;
> bin:=ValueWhen(1,up-dw<>0 OR init,up);
> up:=bin AND (Alert(bin=0,2) OR init);
> dw:=bin=0 AND (Alert(bin,2) OR init);
> NullZone:=Cum(up)>0 AND Cum(dw)<1
>  OR Cum(up)<1 AND Cum(dw)>0;
>
> { Periods since breakouts }
> upPds:=BarsSince(up OR Cum(1)=pds)+2;
> upPds:=If(upPds>pds,pds,upPds);
> dwPds:=BarsSince(dw OR Cum(1)=pds)+2;
> dwPds:=If(dwPds>pds,pds,dwPds);
>
> { Upside breakout-based EMA }
> upEma:=xup*2/(upPds+1)+PREV*(1-2/(upPds+1));
> upEma:=If(NullZone,Mov(xup,pds,E),upEma);
> upEma:=upEma*(1+spread);
>
> { Downside breakout-based EMA }
> dwEma:=xdw*2/(dwPds+1)+PREV*(1-2/(dwPds+1));
> dwEma:=If(NullZone,Mov(xdw,pds,E),dwEma);
> dwEma:=dwEma*(1-spread);
>
> { Composite BEMA }
> BEMA:=(upEma+dwEma)/2;
> LngSht:=If(C>=BEMA,dwEma,upEma);
>
> { Plot on price chart }
> If(plot=1,BEMA,If(plot=2,dwEma,
>  If(plot=3,LngSht,up)));
> If(plot=1,BEMA,If(plot=2,upEma,
>  If(plot=3,LngSht,-dw)))
>
> ---8<-------------------------------------
>
>
>
> =========================
> EMA - (BEMA), dll version
> =========================
> ---8<-------------------------------------
>
> { [B]reakout-sensitive [E]xp [M]ov [A]vg v.dll
>   - Plots much faster than PREV-based version.}
>
> { BEMA based on bars since price breakouts.
>   Options:
>    [1] Composite BEMA: (Upper+Lower)/2;
>    [2] Upper BEMA band based on upside breaks;
>        Lower BEMA band based on downside breaks;
>    [3] BEMA 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 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("BEMA and HHV/LLV lookback periods",
>  1,2520,21);
> plot:=Input("BEMA: [1]Composite, [2]Upper+Lower, [3]
Long/Short",1,4,1
> );
> spread:=Input("Upper/Lower BEMA bands shift %",
>  0,100,2)/200;
> x:=Input("Breakouts, use:  [1]Close,  [2]High/Low",1,2,1);
>
> { Upside breakouts }
> xup:=If(x=1,C,H);
> up:=xup=HHV(xup,pds);
>
> { Downside breakouts }
> xdw:=If(x=1,C,L);
> dw:=xdw=LLV(xdw,pds);
>
> { Remove ghost breakout signals }
> init:=Cum(IsDefined(up+dw))=1;
> bin:=ValueWhen(1,up-dw<>0 OR init,up);
> up:=bin AND (Alert(bin=0,2) OR init);
> dw:=bin=0 AND (Alert(bin,2) OR init);
> NullZone:=Cum(up)>0 AND Cum(dw)<1
>  OR Cum(up)<1 AND Cum(dw)>0;
>
> { Periods since breakouts }
> upPds:=BarsSince(up OR Cum(1)=pds)+2;
> upPds:=If(upPds>pds,pds,upPds);
> dwPds:=BarsSince(dw OR Cum(1)=pds)+2;
> dwPds:=If(dwPds>pds,pds,dwPds);
>
> { Upside breakout-based EMA }
> {upEma:=ExtFml("Forum.VarMOV",xup,upPds,e);}
> upEma:=ExtFml("ASI.EMA",xup,upPds);
> upEma:=If(NullZone,Mov(xup,pds,E),upEma);
> upEma:=upEma*(1+spread);
>
> { Downside breakout-based EMA }
> {dwEma:=ExtFml("Forum.VarMOV",xdw,dwPds,e);}
> dwEma:=ExtFml("ASI.EMA",xdw,dwPds);
> dwEma:=If(NullZone,Mov(xdw,pds,E),dwEma);
> dwEma:=dwEma*(1-spread);
>
> { Composite BEMA }
> BEMA:=(upEma+dwEma)/2;
> LngSht:=If(C>=BEMA,dwEma,upEma);
>
> { Plot on price chart }
> If(plot=1,BEMA,If(plot=2,dwEma,
>  If(plot=3,LngSht,up)));
> If(plot=1,BEMA,If(plot=2,upEma,
>  If(plot=3,LngSht,-dw)))
>
> ---8<-------------------------------------
>
>
> jose '-)
> http://www.metastocktools.com
>



Jose,

Probably a very stupid question but how do I save this dll code as a
dll file?

I can obviously copy it from this board but where should I paste it?

Many Thanks,

Chorlton





SPONSORED LINKS
Business finance course Business finance online course Business finance class
Small business finance Business finance schools Business finance small software


YAHOO! GROUPS LINKS