Skip to content

feat: implement Bollinger Band Width factor#22

Open
Deepak8858 wants to merge 1 commit intoNeuZhou:masterfrom
Deepak8858:feat/bollinger-width-factor
Open

feat: implement Bollinger Band Width factor#22
Deepak8858 wants to merge 1 commit intoNeuZhou:masterfrom
Deepak8858:feat/bollinger-width-factor

Conversation

@Deepak8858
Copy link
Copy Markdown

Fixes #17

Implements the BollingerWidthFactor in the volatility category.

  • Uses the formula: BBW = (Upper Band - Lower Band) / Middle Band (via compute_bollinger_bands builtin).
  • Parameters: period (default 20, range 5-100), num_std (default 2.0, range 1.0-3.0).
  • Includes unit tests in tests/test_bollinger_width.py.
  • Registered under the volatility category for auto-discovery.

Copy link
Copy Markdown
Owner

@NeuZhou NeuZhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Clean implementation.

A few minor notes (non-blocking):

  • Good use of the existing \compute_bollinger_bands\ builtin — avoids duplicating logic
  • Tests verify both correctness (matches builtin output) and edge cases (constant price → 0 width)
  • File placement in \�olatility.py\ is correct for auto-discovery

Two small suggestions for a follow-up:

  1. The test file uses \sys.path.insert\ — this works but isn't needed when pytest runs from the repo root with the package installed. Not a blocker since other test files follow the same pattern.
  2. Consider adding a test for very short input (len < period) to verify graceful NaN handling.

Approved ✅

@NeuZhou
Copy link
Copy Markdown
Owner

NeuZhou commented Apr 13, 2026

@Deepak8858 This has a merge conflict with master (likely due to recent changes to \�olatility.py). Could you rebase/merge master into your branch to resolve? The code itself is approved and ready to merge once conflicts are resolved. Thanks!

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.

Factor: Implement Bollinger Band Width factor

2 participants