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

Re: RUNTIME ERROR Floating point invalid numbers in calculation



PureBytes Links

Trading Reference Links

> Well, I do have those lines in my code, such as:
> If RateOfChange(Close Data2/Close data3, RL) > BZ Then Buy;
> 
> I tried: 
> IFF(Data2=0,0 Close Data2/Close data3, RL) > BZ Then Buy
      ^^^^^^^
> but this gave errors

1. It doesn't know the meaning of Data2, without the specifiying open,
close, whatever.
 
2. You need to check the denominator, not the numerator, so it should be
Data3, not Data2.
 
3. You left out the RateOfChange bit.

> I also tried: 
> If Close Data2 <>0 and Close Data3 <>0 and RateOfChange(Close Data2/Close data3,
> RL) > BZ Then Buy;
> but this gave the same error again

1. This still does the division on every bar so you will get the error
any time Data3 is zero. 

2. You are checking the wrong data stream.


Try this to keep things simple:

If Close Data3 <> 0 then begin
  If RateOfChange(Close Data2/Close data3, RL) > BZ Then Buy;
End;

-- 
  Dennis