technicalindicators icon indicating copy to clipboard operation
technicalindicators copied to clipboard

Pattern Detection help please

Open wilburforce83 opened this issue 5 years ago • 4 comments

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

wilburforce83 avatar Jun 08 '19 14:06 wilburforce83

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

anandanand84 avatar Jun 09 '19 15:06 anandanand84

@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 avatar Jun 09 '19 15:06 wilburforce83

@anandanand84

image

image

FYI:

$ node -v
v10.15.3

wilburforce83 avatar Jun 09 '19 16:06 wilburforce83

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

guzmo avatar Jul 09 '20 14:07 guzmo