hmG3 / TA-Lib.NETCore

📈 A modern port to .NET (C#) of Technical Analysis Library

Home Page:https://hmg3.github.io/TaTooIne

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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