anandanand84 / technicalindicators

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

Pattern Detection help please #179

Open wilburforce83 opened 5 years ago

wilburforce83 commented 5 years ago

Hi,

I think I have set up pattern detection properly, I'm not getting any errors, but I am only ever receiving the result of false for isTrendingUp() or isTrendingDown() . There is no documentation for this anymore either, could some help me with an example, I have the following :

 if (useTrend) {

            isTrendingUp({
                values: closeInput
            }).then(function (response) {
                useTrendbullResult = response
                console.log('trend up: ' + response)
            });
            isTrendingDown({
                values: closeInput
            }).then(function (response) {
                useTrendbearResult = response
                console.log('trend down: ' + response)
            });

        }

closeInput is an array of candle close values 450 long [xxxx,xxxx,xxxx, ... ] Like I say, no errors, but also not a single trigger in hours of testing and I can't get a test array to trigger a true response either. All the candlestick pattern, and indicators are working perfectly.

Also the same for hasHeadAndShoulders() , hasInverseHeadAndShoulders(), hasDoubleTop(), and hasDoubleBottom()

Many thanks,

Will

anandanand84 commented 5 years ago

You can test it using 1, 2, 3, 5, 8, 8, 10, 12, .. or so for trending up. and the reverse for trending down.

wilburforce83 commented 5 years ago

@anandanand84 Thanks for the quick reply. I have done this already, as mentioned, my test array was [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

This gave me the console warning of being less than 250, but continued to show "false". but no errors. Thanks!

wilburforce83 commented 5 years ago

@anandanand84

image

image

FYI:

$ node -v
v10.15.3
guzmo commented 4 years ago

I don't know anything about this library, but some about javascript. You are calling async functions but not waiting for them. When you try to console.log(...) the isTrendingDown()/isTrendingUp() functions might not be done. Easiest way for you to see if that is the problem is to actually log inside of the then() function.

isTrendingDown({ values: closeInput }).then(function(response) { console.log(Trending down -> ${response}) })

Hope it helps