anandanand84 / technicalindicators

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

Incorrect result for stochastic #109

Closed ourarash closed 6 years ago

ourarash commented 6 years ago

I tried this data (sorry if it's too long):

runkit link

But the result seems incorrect. d remains undefined.

gauravchauhan commented 6 years ago

I am also facing same issue https://runkit.com/embed/s41ke7eaefwm

anandanand84 commented 6 years ago

This happens when the close, high and low are same for the entire period; I'll add a fix

Thankyou

anandanand84 commented 6 years ago

Fixed on version 1.1.5

JanMesaric commented 6 years ago

I'm using version 1.1.8 and when having multiple same high, low, close it still returns

Object {d: undefined, k: NaN}

JMoli commented 6 years ago

@JanMesaric How long is the dataset? This can still occur if your period is as long or shorter than the dataset. Try with the data posted by OP to confirm

JanMesaric commented 6 years ago

@JMoli , correct, didn't see that.