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

Re: [EquisMetaStock Group] indicator...Division by zero



PureBytes Links

Trading Reference Links

Colin,

Lionel makes some excellent points here.

In looking at your formula I see some things that are very confusing.
Look at this line:
Mov((Mov((((CLOSE-LLV(L,Per1))/(HHV(H,Per1)-LLV(L,Per1)))
*100),Per2,S)),Per3,S)

The second moving average argument has 4 "(" after it. One is 
usually enough. Lionel's statement about a seperate calculation is 
most appropriate here! By doing this you can eliminate the extra use 
of "( )" and save yourself some confusion in the process.

Let me also address another potential problem...the division by zero 
error.

Yesterday the question was asked about the problem and the solution 
was to use a MAX argument to solve the problem. I tried your formula 
and did not get the error. If you are getting the error then I would 
guess that it is coming from a stray parenthesis mark that is in the 
wrong place...again this supports Lionel's suggestion.

Lets rewrite your formula and use:
 
Numerator/Max(Denominator,.0000001)

to see if we can remove your errors. We will also clean up the 
formula a bit to see if we can eliminate any confusion. Like this:


Per1:=Input("length of stoch",1,100,14);
Per2:=Input("length of ma1",1,100,3);
Per3:=Input("length of ma2",1,100,3);
Numer:=Close ? LLV(Low,per1);
Denom:=HHV(High,per1) ? LLV(Low,per1);
Sto:=(Numer/Max(Denom,.0000001))*100;
Mov(Mov(Sto,Per2,S),Per3,S);{end}


See if that doesn't solve your problem.

Hope this helps,


Preston
 


--- In equismetastock@xxxxxxxxxxxxxxx, "Lionel Issen" <lissen@xxx> 
wrote:
>
> Try calculating the divisor separately Like this
> 
> D=(HHV(H,Per1)-LLV(L,Per1)))*100),Per2,S)),Per3,S)
> 
> And put in a requirement that D is greater than some small number.
> 
>  
> 
> Another problem is that Metastock uses single precision 
arithmetic. This
> means that your calculations will be inherently inaccurate as you 
are
> dealing with small differences of large numbers. Try a simpler 
indicator or
> do it in Excel.
> 
> 
> 
> Metastock's very weak excuse is that they do this to save disk 
space. This
> may have been true in the past, but with multi gig hard drives 
selling for
> less that fifty cents a gig, this argument is specious.
> 
>  
> 
> Lionel
> 
>  
> 
>  
> 
> From: equismetastock@xxxxxxxxxxxxxxx 
[mailto:equismetastock@xxxxxxxxxxxxxxx]
> On Behalf Of Colin
> Sent: Wednesday, August 22, 2007 8:07 AM
> To: equismetastock@xxxxxxxxxxxxxxx
> Subject: [EquisMetaStock Group] indicator
> 
>  
> 
> Hi, 
> Can someone help me with this indicator.Many thanks in advance.
> The parameter I'm using is 5,5,5 and everytime when plotted in the 
chart
> it prompt me ( the following math errors occurred during the 
calculation of
> slow stoch, Divivion by zero.)
> Slow Stochastic %D
> 
> Per1:=Input("length of stoch",1,100,14);
> Per2:=Input("length of ma1",1,100,3);
> Per3:=Input("length of ma2",1,100,3);
> Mov((Mov((((CLOSE-LLV(L,Per1))/(HHV(H,Per1)-LLV(L,Per1)))
*100),Per2,S)),Per3
> ,S)
> 
> Thanks for your attention.
> 
> Best regards,
> 
> Colin Chan
> 
> [Non-text portions of this message have been removed]
> 
>  
> 
> 
> 
> [Non-text portions of this message have been removed]
>




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/