Skip to content

Commit

Permalink
Update doji.js
Browse files Browse the repository at this point in the history
  • Loading branch information
thanhnguyennguyen authored Jun 28, 2023
1 parent 1cb17fa commit e1ec665
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions candlestick-pattern/doji.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ const THRESHOLD = parseFloat(2 / 10_000)

const isDojiPattern = async (input) => {
try {
const last = input.close.length - 1
const body = Math.abs(input.close[last -1] - input.open[last - 1])
if (parseFloat(body / input.close.slice(-1)) < THRESHOLD) {
const last = input.open.length - 2 // confirmed candle : last - 2
const body = Math.abs(input.close[last] - input.open[last])
if (parseFloat(body / input.close[last]) < THRESHOLD) {
return true
}
return false
Expand Down

0 comments on commit e1ec665

Please sign in to comment.