anandanand84 / technicalindicators

A javascript technical indicators written in typescript with pattern recognition right in the browser
MIT License
2.16k stars 558 forks source link

Error in mfi calculating #252

Open ikulichkov opened 2 years ago

ikulichkov commented 2 years ago

Hello, you have an error in the MFI calculations and wrong calculating

now:

               if ((positiveFlow.totalPushed >= period) && (positiveFlow.totalPushed >= period)_) {
                    moneyFlowRatio = positiveFlowForPeriod / negativeFlowForPeriod;
                    result = 100 - 100 / (1 + moneyFlowRatio);
                }

after:

                if ((positiveFlow.totalPushed >= period) && (negativeFlow.totalPushed >= period)) {
                    moneyFlowRatio = positiveFlowForPeriod / negativeFlowForPeriod;
                    result = 100 - 100 / (1 + moneyFlowRatio);
                }

and now calculating is corret