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

Re: [EquisMetaStock Group] IF () statement question



PureBytes Links

Trading Reference Links

Hi Harry

I'll take a look at your code when I have time but off the top of my head
I'd say you've got exactly the problem you started with. The "guts" of the
matter that anything outside IsDefined() will be subject to the usual N/A
periods, and anything inside is incapable of passing a value to the outside.

Why am I not surprised that support staff couldn't fix the problem.

Understand that I've been working on eliminating, or at least reducing, N/A
periods since version 6.52, about 5 years. I know several tricks for keeping
N/A periods to a minimum in different situations, and initially I thought
all those problems were over when the "defined" functions were added with
release 7.0. I quickly found out that all they do is confirm the status of
an indicator without providing any means to properly manage its output.

N/A periods are cumulative too. If you have a 50 period moving average then
smooth that with another 50 period MA you've immediately got 100 N/A
periods. The same should not be true when using the Security() function, but
it is a limitation of the Ref() function which you are using.

Here's a substitute for Ref(). It can cause problems and needs to be used
with care, but it should not add to the N/A count any more than the number
of periods in the longest ValueWhen().

ValueWhen(40 {one more than Ref()},1 {always
true},Security("FWRLX",C){signal to delay})
so...
ValueWhen(40,1,Security("FWRLX",C))
is logically identical to...
Ref(Security("FWRLX",C),-39)
except that it will only cause 39 N/A periods, whereas Ref() will continue
to add it own N/A count to any existing N/A count from previous lines of
code.

All this is not going to solve your problem but it may alleviate it a
little. I'll come back to you when I've looked more closely at your
discussion below.

Roy

----- Original Message ----- 
From: "bex1210" <hmw3@xxxxxxxxxxxxxx>
To: <equismetastock@xxxxxxxxxxxxxxx>
Sent: Tuesday, July 01, 2003 5:13 PM
Subject: Re: [EquisMetaStock Group] IF () statement question


> Roy/Jay:
>
> I got a response from Metastock. The formula they suggested did not work,
but in studing the concept, I found what I thought was a solution: but it
lead me to a NEW problem with the IF() function. Perhaps one of you has seen
this one.
>
> The concept is this: use nested IF() statements. The IsDefined() function
calls another IF() statement if all the data is available, and the nexted
IF() statement does the actual math calculations.
>
> Here is a simple example, using Fidelty Select fund FWRLX, which began
trading Nov. 3, 2000.
>
> If(IsDefined(Ref(Security("FWRLX",C),-39))>0,If(6>5,4,2,),0)
>
> The IsDefined() function is TRUE 39 weeks after Nov. 3, or about Aug. 3,
2001. It then returns a "1", which is >0, so the nested IF() statement is
called. Since 6 is always >5, a "4" is plotted. When the IsDefined()
function is FALSE, 0 is NOT >0, so the nested IF() statement is bypassed,
and a "0" is plotted.  I charted this, and it works fine. The "0" is plotted
as far back in time as when my base security (FSAIX) started trading (about
1993)
>
> But then I tried to take it another step, and substituted a Secutity ()
function to replace "6>5" in the nested IF() statement. The new formula is
as follows:
>
>
If(IsDefined(Ref(Security("FWRLX",C),-39))>0,If(Security("FWRLX",C>0,4,2,),0
)
>
> Because the nested IF() statement should only be called when the
ISDefined() function is TRUE, this formula should always work, because on
the dates the IsDefined() is TRUE, the nested IF() statement always contains
data.
>
> But it doesn't work. The "4" is plotted after Aug. 3, 2001, just like the
first formula. A "0" is plotted between Nov. 3 2000 and Aug. 3 2001. But
NOTHING is plotted before Nov. 3 2000. It appears that Metastock is not
completely bypassing the nested If() statement. If that nested If()
statement does not have enough data, then the formula does not plot, even
though the If() statement should have been bypassed.
>
> I hope you understand why I am trying to convey here. If so, do you know
how the Metastock If() statement actually functions?
>
> Harry
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx> wrote:
> > Jay
> >
> > > I've been following this thread a bit with interest and as I
understand
> > the
> > > problem, if one of several nested IF statement doesn't have supporting
> > data or
> > > data within the bounds of its individual statement, then MetaStock
throws
> > out
> > > the entire set of IF statements.  If you are looking to see if a work
> > around
> > > exits, I would expect that MetaStock support could answer your
question
> > very
> > > quickly.  I've received very fast email responses from them on this
very
> > type of
> > > issue.  They answer in less than 24 hours during M-F business days.
> >
> > Your suggestion makes sense but I lack your faith in Support being able
to
> > conjure up a helpful reply for an obvious "screw-up" in another
department
> > (with feature implementation in 7.0).
> >
> > I have more confidence in my own ability to resolve the MS problems, and
> > since Equis has already messed up big-time (with Isdefined() etc.) with
this
> > one, and made no effort over subsequent releases to fix it as far as I
can
> > see, I have no interest in being fed a spin that conveniently explains
it
> > all away. I've forgiven Equis for many deficiencies but the one under
> > discussion is one that still makes me angry because the solution lies in
an
> > IsDefined() function that REALLY work instead of just pretending to.
> >
> > We know that there are Equis representatives in this group, and one in
> > particular is more than happy to tell us about new products, but how
often
> > have we seen anyone from Equis jump in to assist with MS problems? A few
> > members have been kind enough to share helpful responses to their
questions
> > directed to the Support as you suggest, but ask yourself where you've
picked
> > up the most useful MS information from.
> >
> > Please understand, I'm not criticising your suggestion. Personally I
don't
> > feel the need to ask for help on this one. I've struggled with many MS
> > problems over the last few years, and I've solved a few of the
"impossible"
> > ones along the way. The solution to managing the N/A problem lies in a
> > proper implementation of IsDefined(). End of story. I'm sure Equis have
been
> > asked to read this chapter of the book but how many years since 7.0 came
out
> > and the function's as useless as ever.
> >
> > Well, I've got that off my chest and I feel much better.
> >
> > Roy
>
>
>
> 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/
>
>
>
>



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/BefplB/TM
---------------------------------------------------------------------~->

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/