PureBytes Links
Trading Reference Links
|
Here's an example of how isdefined() can be helpful (see below). One
common cause of N/A are moving averages (or other formulas) defined
for a greater number of periods than the loaded data. Jose's formula
simply reduces this number of periods for the indicator; which
eliminates this problem. Note that Jose defined the EMA formula
himself, rather than using the built-in MS EMA command. The reason
for this is that built-in MS functions (any function such as EMA,
RSI, CCI, highest(), sum(),etc.) won't accept *varying* periods.
Unfortunately, there are some formulas that simply *can't* be
created without these built-in functions and others (such as EMA)
that require a previous statement which *dramatically* slows down
processing.
Another common cause of N/A is division by zero. Adding a .0001 to
the result of any calculated "divided by" number (e.g. A/(B-C)+.0001
will eliminate this cause.
Regards,
TOB
===
EMA
===
---8<---------------------------
{ Exponential Moving Average v2.2 }
{ EMA periodicity shortens on low bar count }
{ ©Copyright 2003-2004 Jose Silva }
{ josesilva22@xxxxxxxxx }
pds:=Input("EMA periods",1,2520,21);
x:=Input("use Open=1 High=2 Low=3 Close=4 WClose=5 P=6",1,6,4);
shift:=Input("EMA vertical shift %",
-100,100,0)/100+1;
plot:=Input("[1]EMA, [2]Crossover signals",
1,2,1);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,WC(),If(x=6,P,C)))));
pds:=If(pds>Cum(IsDefined(x)),
Cum(IsDefined(x)),pds);
Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
Ema:=Ema*shift;
signals:=Cross(x,Ema)-Cross(Ema,x);
If(plot=2,signals,Ema)
---8<---------------------------
--- In equismetastock@xxxxxxxxxxxxxxx, "Charlie" <huasang@xxxx>
wrote:
> Will IsUndefined() work?
>
> ----- Original Message -----
> From: "Roy Larsen" <rlarsen@xxxx>
> To: <equismetastock@xxxxxxxxxxxxxxx>
> Sent: Tuesday, November 09, 2004 2:35 PM
> Subject: Re: [EquisMetaStock Group] Re: Formula that produces an
NA Value
>
>
> >
> > Dorsey
> >
> > There are as many tricks for overcoming the problem you've
described. The
> > most common culprits are
> > BarsSince, and ValueWhen or one of the other Nth parameter type
functions.
> > ValueWhen will be getting
> > particular attention in the December newsletter, and the
principles that
> > work for ValueWhen can also
> > be applied to a number of other functions to minimise or
preferably
> > eliminate the dreaded N/A plot.
> >
> > Kind regards
> >
> > Roy Larsen
> > www.metastocktips.co.nz
> > Free formulas and MS links
> >
> >
> >
> > ----- Original Message -----
> > From: "pumrysh" <no_reply@xxxxxxxxxxxxxxx>
> > To: <equismetastock@xxxxxxxxxxxxxxx>
> > Sent: Tuesday, November 09, 2004 6:53 PM
> > Subject: [EquisMetaStock Group] Re: Formula that produces an NA
Value
> >
> >
> >>
> >>
> >> Dorsey,
> >>
> >> You will need to provide the formula if you expect useful help.
> >>
> >> Preston
> >>
> >>
> >> --- In equismetastock@xxxxxxxxxxxxxxx, dodgereated
<no_reply@xxxx>
> >> wrote:
> >>>
> >>>
> >>> I am using a forumula that produces an NA sometimes as a value.
> >>> Unfortunately when I use it in the explorer, the explorer
discards
> >>> the stock with an error in the formula. How can I avoid this
> >>> situation?
> >>>
> >>> Thanks,
> >>>
> >>> Dorsey
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> Yahoo! Groups Links
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/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/
|