Divide by zero in CCI
MostafaEsmaeili opened this issue · 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