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

Re: Odd problem in trying to write an indicator



PureBytes Links

Trading Reference Links

Your formula here gives a Math Error:
     "Division by zero:      4"

Tho multiplied by 100, the 1st part of your formula sometimes
gives strong >-200 negative values (eg well below 0), the
above error is not related to these negative values(see also below).

The 2nd part, however, here gives at least 4 times
(actualy sometimes 8+ times) a value of 0.

(This is testing BAAN Comp.'s history in €uro's).

You will have to solve this error first before continuing, for as
unpredictable results, eg actual calculation bugs (f.i. "straight lines")
are bound to follow.
(Tho contra your calculations and thinking, these lines
are still program's 'proper' calculations (just turning buggy
from the above error)).

Regards,
Ton Maas
ms-irb@xxxxxxxxxxxxxxxx
Dismiss the ".nospam" bit (including the dot) when replying and
note the new address change. Also for my Homepage
http://home.planet.nl/~anthmaas

=========================================
Math Errors  (MSK6.5 Help - p. 282)

If you attempt to plot (or execute) a formula that contains math errors,
the following dialog will appear prior to plotting the indicator.

***The dialog shows the number of occurrences for each error.***

Division by zero.
A formula is dividing a value by zero.
For example,  the formula "(ref(close,-1)-open)/(high-low)"
will produce a division by zero error if the high and low are equal.

===================================================

----- Original Message -----
From: Owen Davies <owen@xxxxxxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: woensdag 15 december 1999 4:24
Subject: Re: Odd problem in trying to write an indicator


> >       100 * (RSI - BollingerBandBottom) / (BBTop - BBBottom)
> >
> >Just applying this custom formula, will give 'errors'.
> >
> >The Function RSI can be called automatically, but the other three(3) BB's
> >for Functions will have to be defined first.
>
>
> No doubt I should have just fired up Metastock and pulled the formula
> out of the Indicator Builder instead of just sketching it in with an ad hoc
> pseudocode and assuming everyone would understand.  However,
> the Bollinger band functions are the BBandTop and BBandBot functions
> that you paste in off the list.  Here's how the formula really reads:
>
> RSILen:=Input("RSILen",2,50,5);
> BBLen:=Input("BBLen",3,50,3);
> 100 * (RSI(RSILen) -  BBandBot(RSI(RSILen),BBLen,E,2)) /
> (BBandTop(RSI(RSILen),BBLen,E,2) - BBandBot(RSI(RSILen),BBLen,E,2));80;20
>
> Works just fine.  However, when I tried to average three different ones,
> I dumped the input statements and hard-coded the RSI and Bollinger
> band lengths.  Somehow, I can't convince myself that this was where I
> went wrong.
>
> I appreciate whatever help anyone can provide.
>
> Owen Davies
>
>