From 1cb17fa6fa7944f34dc1cbc7bd65157744f1edb5 Mon Sep 17 00:00:00 2001 From: NguyenNguyen Date: Wed, 28 Jun 2023 16:19:20 +0700 Subject: [PATCH] Update hammer.js --- candlestick-pattern/hammer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/candlestick-pattern/hammer.js b/candlestick-pattern/hammer.js index 04bc7f8..0c84fcc 100644 --- a/candlestick-pattern/hammer.js +++ b/candlestick-pattern/hammer.js @@ -2,7 +2,7 @@ const BEARD_FACTOR = 3 const isBullishHammerPattern = async (input) => { try { - const last = input.open.length - 1 + const last = input.open.length - 2 // confirmed candle : last - 2 if (last < 4) { console.error(`Require OHLCV of last 5 candles`) return false @@ -26,7 +26,7 @@ const isBullishHammerPattern = async (input) => { const isBearishHammerPattern = async (input) => { try { - const last = input.open.length - 1 + const last = input.open.length - 2 // confirmed candle : last - 2 if (last < 4) { console.error(`Require OHLCV of last 5 candles`) return false @@ -50,7 +50,7 @@ const isBearishHammerPattern = async (input) => { const isBullishInvertedHammerPattern = async (input) => { try { - const last = input.open.length - 1 + const last = input.open.length - 2 // confirmed candle : last - 2 if (last < 4) { console.error(`Require OHLCV of last 5 candles`) return false @@ -74,7 +74,7 @@ const isBullishInvertedHammerPattern = async (input) => { const isBearishInvertedHammerPattern = async (input) => { try { - const last = input.open.length - 1 + const last = input.open.length - 2 // confirmed candle : last - 2 if (last < 4) { console.error(`Require OHLCV of last 5 candles`) return false