Hi Preston
The name of a dll is immaterial as far as I can
gather. I use the ForumDll but have renamed it as "Forum" for my own use. I'd
use a shorter name still if I could think of anything appropriate. Marks
GlobalVar will always be GV in my code, though I also have copies that only use
a single letter for the name.
I think it would be useful if the programmers
writing dlls could grasp the concept that MetaStock has very limited space for
individual formulas. Short names are far preferable to names that have the
appearance of being sentences without spaces.
Renaming Dlls is easy and effective (or renaming a
copy perhaps), but shortening internal function names is not possible for most
users. I notice that ForumDll.dll has a VarSUM function, while ASI.dll has a SUM
function. They're both variable period summations but one is much more
economical with the available space. The Enhanced System Tester windows only
accept a little over 1000 characters, and long formula and function names to
nothing to ease that problem.
I do appreciate the capabilities of some of the new
free dlls being created, but sometimes I think it would be good if the
developers knew more about MetaStock and less about programming. Just my
thoughts.
Regards
Roy
----- Original Message -----
Sent: Sunday, November 13, 2005 6:27 AM
Subject: [EquisMetaStock Group] Re: Pivotal EMA (PEMA)
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 LINKS
|