kylejusticemagnuson / pyti

Python library of various financial technical indicators
MIT License
646 stars 169 forks source link

relative_strength_index calculation is not correct; there is huge difference with actual RSI #30

Open msarm opened 4 years ago

msarm commented 4 years ago

relative_strength_index calculation is not correct; there is huge difference with actual RSI

whiteking64 commented 4 years ago

These 2 lines below are inaccurate: the variables gains and losses should be 0 or positive, but they can return negative values. https://github.com/kylejusticemagnuson/pyti/blob/2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2/pyti/relative_strength_index.py#L22 https://github.com/kylejusticemagnuson/pyti/blob/2f78430dfd60a0d20f4e7fc0cb4588c03107c4b2/pyti/relative_strength_index.py#L25

Removing is True or substituting it with == True in the for loop work. (though I don't know why..)

msarm commented 4 years ago

it works now. Need to run with different samples.