PureBytes Links
Trading Reference Links
|
Martin
> I have a custom formula, and one of its line is as follow:
> varA:= IF(H=L,0,Abs(O-C)/(H-L));
>
> Basically, I want to make sure that there is a difference between
> High and Low on a given period before performing the calculation.
>
> My problem is that "Abs(O-C)/(H-L)" seems to get evaluated, even if
> H=L.
This happens because of the precedence that expressions in a formula are given when MS is
calculating the result. The division by zero is performed (and therefore reports the error) before
the IF() function is evaluated. Put another way, what's in the innermost brackets is calculated
first. Any error will be reported to the next calculation that evaluates the result. The If()
function will not solve such a problem and it must be handled in another way, such as the
suggestions that have already been made.
Roy
> If H=L, the final result will be accurate, *BUT* I will still get
> the "division by zero" error when opening the chart.
>
> Is there a workaround for this? Maybe a way to "tell" MetaStock to
> not look at a piece of code that does not match a condition?
>
> Thanks!
> Martin
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
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/
|