Hi Rick
I notice that you are not using the current version
of the Forum DLL. My testing shoes that the older version's RSI function returns
a different result to the newer version's RSI function if your "vp"
variable is used to set the Variable Period parameter.
There also appears to be a divide-by-zero error
generated by your formula on some charts. Here's how I would lay out your
formula to to make it easier (for me) to follow and fix. I have no idea where
your floating point overflow error is coming from as I haven't been able to
reproduce that error.
{ZZ StockRSI} vp:=Fml("ZZ Trend
Cycle"); vr:=ExtFml("forumdll.VarRSI",C,vp); vl:=ExtFml("forumdll.VarLLV",vr,vp); vh:=ExtFml("forumdll.VarHHV",vr,vp); ds:=Sum(vh-vl,3);
{divisor sum}
20; 80; 100*Sum(vr-vl,3)/(ds+(ds=0));
Here's essentially the same formula but using the
most recent version of the Forum DLL. Both formulas convert a zero divisor to 1.
Placing fixed-value line outputs prior to the calculated output makes it
possible to call the formula for an exploration and pick up the calculated
value (the last output) instead of a constant.
{ZZ StockRSI} vp:=Fml("ZZ Trend
Cycle"); vr:=ExtFml("forum.RSI",C,vp); vl:=ExtFml("forum.LLV",vr,vp); vh:=ExtFml("forum.HHV",vr,vp); ds:=Sum(vh-vl,3);
{divisor sum}
20; 80; 100*Sum(vr-vl,3)/(ds+(ds=0));
Regards
Roy
----- Original Message -----
Sent: Wednesday, January 28, 2009 8:38
AM
Subject: [EquisMetaStock Group] Re:
StochRSI
Thanks very much Preston for narrowing down the problem. I found
one error in my "Zig Trend Cycle" formula, which is an adaptation of
a Spyros Raftopoulos formula but I'm still getting a "An MSX DLL
is reporting a floating point overflow error referenced
DLL "forumdll.VarRSI" when I use it as a variable period input. It
("Zig Trend Cycle") plots fine on it's own, as does VAR StochRSI" but
they don't together. Here is the code for "Zig Trend Cycle" with
comments on the original by Mr. Raftopoulos. I have tried to make it a
cycle count indicator. Please excuse my pathetic coding
abilities:
{The SR Zigzag Trend indicator. This indicator returns 1
for valid uptrend and -1 for valid downtrend, REJECTING ALL the INVALID
readings of zig(). It can be used as a stand-alone indicator (even in zig's
place). It is useful for visual inspection but also for many other
purposes. ALL its readings (present and past ones) are trusty. It can be
safely used in systems and if pasted in the system tester its variables
can be even optimised. In my opinion one does not really need my
"ZigZag Validity" anymore. One can do the job much more effectively with
"SR ZigZag Trend" which is always reliable and safe. Additionally "SR
ZigZag Trend" ("SR ZZT" for short) returns also the direction of the
trend. It is like having an always-valid zigzag indicator!
This
indicator can calculate not only Close prices but also other price fields
including various plots. This means that you can drop it on RSI,
Stochastics etc. provided that the "vr" value=0 (the "P" variable), which
for this reason is the default option.
One can also choose between the
Percent and the Points method. The last one is better suited to
indicators, especially those, which return negative
values.}
{******** Start of code **********}
{SR ZigZag Trend
(SR ZZT) v.4} {by Spyros Raftopoulos}
{It is based on the Zig Zag
indicator and it returns 1 for a confirmed uptrend, and -1 for a confirmed
downtrend.}
{****************************************}
vr:=CLOSE; amnt:=3; md:=1; {****************************************}
zz0:=If(md=1,
Zig(vr,amnt,%),
Zig(vr,amnt,$)); zz1:=Ref(zz0,-1); zz2:=Ref(zz0,-2); {****************************************}
tr:=ValueWhen(1,zz0>zz1
AND zz1<zz2, zz1); pk:=ValueWhen(1,zz0<zz1 AND zz1>zz2,
zz1); PU:=If(md=1,tr+Abs(tr)*amnt/100,tr+amnt); PD:=If(md=1,pk-Abs(pk)*amnt/100,pk-amnt);
res:=If(vr>=PU
AND zz0>zz1,1, If(vr<=PD AND
zz0<zz1,-1,0)); res:=If(res<>0,res,ValueWhen(1,res<>0,res)); rescycle:=If(res
= 1,(BarsSince(res=-1 AND
Ref(res,-1)=1))- BarsSince(res=-1),(BarsSince(res=1 AND
Ref(res,-1)=-1))-BarsSince(res=1)); res1:= If(res=1,BarsSince(
res=-1),BarsSince(res=1)); res:=If(res1>rescycle,res1,rescycle); res
{********
End of code **********}
--- In equismetastock@yahoogroups.com,
pumrysh <no_reply@xx.> wrote: > > Rick, >
> You may not be getting a value from the Fml("Zig Trend Cycle")
> variable. > > To check this try: > >
vp:=Fml("Zig Trend Cycle"); > vp; > > When I replaced
vp:=Fml("Zig Trend Cycle"); with > vp:= 10; > the plot was
fine. > > Preston > > > > > ---
In equismetastock@yahoogroups.com,
rickbriggs1 <no_reply@> > wrote: > > > > I'm
trying to use the forum.dll functions to rewrite Chande's >
StochRSI > > for variable periods and something is wrong somewhere.
Can anyone > spot > > the problem? It doesn't plot. I have
included the original PS > StochRsi > > formula for reference
at the end. Any help would be freatly > > appreciated. Thanks in
advance. Rick. > > > > vp:= Fml("Zig Trend Cycle"); >
>
Sum(ExtFml("forumdll.VarRSI",C,vp)-ExtFml("forumdll.VarLLV", >
>
ExtFml("forumdll.VarRSI",C,vp),vp),3)/Sum(ExtFml("forumdll.VarHHV", >
>
ExtFml("forumdll.VarRSI",C,vp),vp)-ExtFml("forumdll.VarLLV",ExtFml >
> ("forumdll.VarRSI",C,vp),vp),3)*100;20;80 > >
> > {Original: > >
Sum(RSI(10)-LLV(RSI(10),10),3)/Sum(HHV(RSI(10),10)-LLV(RSI >
(10),10),3))*100; > > 20; > > 80} >
> >
__________ NOD32 3804 (20090127)
Information __________
This message was checked by NOD32 antivirus
system. http://www.eset.com
__._,_.___
__,_._,___
|