Skip to content
All library documents

Bollinger %B Entries with Divergence Add-Ons

Article Strategy library · Author: mpio222

Summary

This Pine strategy uses Bollinger %B, calculated from a moving average and standard deviation bands, to time long trades. It opens an initial long when %B crosses above zero, then closes the position when %B reaches or exceeds one. A bullish divergence condition compares current price and %B with values from a lookback interval; if it appears while a position is open, the strategy adds a larger fixed-quantity long entry. It also calculates and plots bearish divergence alerts, but those alerts do not drive an order in the supplied logic.

A stop price is set below the close at entry and updated on an add-on, with the position closed if price falls to it. The script provides no backtest results, market, or timeframe, so its performance cannot be assessed. The configured stop distance is 100% of entry price, making the nominal protection exceptionally wide; the add-on quantity also differs from the percentage-of-equity sizing used for the initial entry. Divergence uses closes rather than confirmed swing pivots, which may make signals noisy.

Key ideas

  • The initial long signal occurs when Bollinger %B crosses above zero.
  • A position exits when %B reaches the upper band threshold of one.
  • A bullish divergence near the lower part of the %B range can trigger an add-on while long.
  • Bearish divergence is plotted as an alert but does not close or open a position in the supplied logic.
  • The strategy sets a stop from entry price, but its configured 100% distance is very wide.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.