Skip to content

fix: equilty logic for isEngulfed#61

Open
Rahaman2 wants to merge 1 commit intocm45t3r:mainfrom
Rahaman2:main
Open

fix: equilty logic for isEngulfed#61
Rahaman2 wants to merge 1 commit intocm45t3r:mainfrom
Rahaman2:main

Conversation

@Rahaman2
Copy link

@Rahaman2 Rahaman2 commented Mar 2, 2026

Pull Request

What does this PR do?

This PR fixes a bug in the isEngulfed logic where identical candlesticks were incorrectly identified as being engulfed. I have updated the boundary comparisons to ensure that while a candle can share one boundary with the previous one (e.g., equal Open), it must be strictly larger on at least one side to qualify as an engulfing candle.

Fixes #60
Briefly describe your changes and link any related issues.

Checklist

  • All tests pass (npm test)
  • Lint passes (npm run lint)
  • Code is formatted (Prettier)
  • Documentation updated (if needed)
  • PR description explains the change

Additional context

The previous implementation used inclusive >= and <= operators without a secondary check, meaning isEngulfed(candleA, candleA) would return true. This fix maintains inclusivity for "Equal Opens/Closes" (which is common in trading) but correctly returns false for identical bodies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isEngulfed with faulty equality logic

1 participant