Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KVO gives NaN value when close = low = high #92

Open
magicjase11 opened this issue Mar 15, 2020 · 4 comments
Open

KVO gives NaN value when close = low = high #92

magicjase11 opened this issue Mar 15, 2020 · 4 comments

Comments

@magicjase11
Copy link

magicjase11 commented Mar 15, 2020

Hi, when using KVO,

if the close = low = high, it throws a NaN value (I'm using the Node version of this) and then never recovers. i.e. all proceeding values also become NaN.

example is:
{ "symbol": "vxx", "timestamp": "2020-02-19T12:18:00-05:00", "tradingDay": "2020-02-19", "open": 13.565, "high": 13.565, "low": 13.565, "close": 13.565, "volume": 400 }

changing it to
{ "symbol": "vxx", "timestamp": "2020-02-19T12:18:00-05:00", "tradingDay": "2020-02-19", "open": 13.565, "high": 13.566, "low": 13.565, "close": 13.565, "volume": 400 }

fixes it.

@magicjase11 magicjase11 changed the title KVO gives NaN value when open = low = high KVO gives NaN value when close = low = high Mar 15, 2020
@codeplea
Copy link
Member

If you look at the formula for KVO here https://tulipindicators.org/kvo you'll notice that there is a divide by zero in the case where high = low, hence the NAN. I'll need to study the code and change it so the behavior matches what happens in the limit.

Thanks for bringing this to my attention.

@cdohotaru
Copy link

I noticed this behaviour as well. Any updates on this @codeplea ?
On a different note, I am seeing different values calculated by the indicator when I compare them to, for example, tradingview.com. I don't know if the issues are related and that's why I didn't open a new issue.
Do you know why the values could be different (I'm using the same symbol and the same data source and settings)?

@codeplea
Copy link
Member

codeplea commented Aug 4, 2020

@cdohotaru Tradingview differs an a lot of stuff. It really just depends on the indicator.

I don't consider TV to be an authoritative source. All of the indicators in TI are implement from their original descriptions, whenever possible.

@cdohotaru
Copy link

cdohotaru commented Aug 5, 2020

@codeplea OK, thanks for the reply.
As it happens, this is the only indicator from quite I few that I used that has very different values. All the others I used match to the second decimal so I figured that maybe there's an issue with this indicator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants