const hammer = require('technicalindicators').hammerpattern;
var hammerData = [
{
name: 'Bearish',
data: {
open: [40.90, 36.00, 33.10, 30.10, 26.13],
high: [41.80, 37.60, 35.90, 30.10, 33.60],
close: [36.00, 33.10, 29.50, 26.13, 31.00],
low: [28.00, 27.70, 26.90, 10.06, 25.90],
},
},
{
name: 'Bearish Inverted',
data: {
open: [40.90, 36.00, 33.10, 29.10, 26.13],
high: [41.80, 37.60, 35.90, 36.10, 33.60],
close: [36.00, 33.10, 29.50, 26.13, 31.00],
low: [28.00, 27.70, 26.90, 26.13, 25.90],
},
},
{
name: 'Bullish',
data: {
open: [40.90, 36.00, 33.10, 26.13, 26.13],
high: [41.80, 37.60, 35.90, 30.10, 33.60],
close: [36.00, 33.10, 29.50, 30.10, 31.00],
low: [28.00, 27.70, 26.90, 10.06, 25.90],
},
},
{
name: 'Bullish Inverted',
data: {
open: [40.90, 36.00, 33.10, 26.13, 26.13],
high: [41.80, 37.60, 35.90, 36.10, 33.60],
close: [36.00, 33.10, 29.50, 29.10, 31.00],
low: [28.00, 27.70, 26.90, 26.13, 25.90],
},
},
];
hammerData.forEach((patternSet) => {
const result = hammer(patternSet.data) ? 'yes' : 'no';
console.log(`Is Hammer Pattern: ${patternSet.name}? : ${result}`);
});