TA-Lib.NETCore icon indicating copy to clipboard operation
TA-Lib.NETCore copied to clipboard

Divide by zero in CCI

Open MostafaEsmaeili opened this issue 5 years ago • 0 comments

I Faced Divide by zero exception in cci calculation. It does not occur most of the time but in a rare situation, it throws this exception:

outReal[outIdx++] = tempReal != Decimal.Zero && tempReal2 != Decimal.Zero ? tempReal / (0.015m * (tempReal2 / optInTimePeriod)) : Decimal.Zero; tempReal2 = 0.000000000000000000000000040M ; optInTimePeriod = 20;

  | (0.015m * (tempReal2 / optInTimePeriod)) | 0.0000000000000000000000000000 | decimal

tempReal / (0.015m * (tempReal2 / optInTimePeriod))--> Devide By Zero Exceprion

MostafaEsmaeili avatar Dec 07 '20 10:12 MostafaEsmaeili