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

Three Black Crows possibly returning wrong result #136

Open KashyapCKotak opened 6 years ago

KashyapCKotak commented 6 years ago

Here is my input: var input = { open: [7707.82, 7684.76, 7675.76], high: [7709.61, 7695.64, 7677.15], close: [7684.76, 7675.04, 7651.54], low: [7682.37, 7672.36, 7647.49] }

Here's how it looks on a graph: image

for three black crows: var result = threeblackcrows(input); //returns FALSE shouldn't this return true??

anandanand84 commented 6 years ago

seems correct to me.

anandanand84 commented 6 years ago

The three black crows pattern should ideally consist of three relatively long bodied bearish candlesticks that close at or near the low price for the period. The second candle almost closes near the low

KashyapCKotak commented 6 years ago

aren't all the candles closing near low?

anandanand84 commented 6 years ago

ok got. It should return true instead it return false. May be it is also expecting high should be near the open.

KashyapCKotak commented 6 years ago

I tried reducing the middle one to have almost no upper shadow... But it still returned false...

anandanand84 commented 6 years ago

ok I'll check it out.

JMoli commented 6 years ago

I see nothing wrong with the input / logic... If I had to guess I bet something is getting reversed before being passed to threeblackcrows... @KashyapCKotak Can you test the same input with the same implementation with threewhitesoldiers just to remove this as a possibility?

JMoli commented 6 years ago

Nvm I did it and see they are both false... Weird I will look closer

JMoli commented 6 years ago

Okay, the problem is the second day open is EQUAL to the first day close... looks like we need to add >= to the logic test instead of just greater than (edge case but needs to be handled)... but I am not sure what other implications this would bring...