Price Bands

The Price Bands are a variant of the Bollinger Bands whose width comes from how far a fast moving average of the price strays from the slow one, rather than from how far the price itself strays. Brian G. Peterson defined them in the R package TTR.

The formula for the Price Bands starts from the same middle band as the Bollinger Bands, the simple moving average of the closing price over the last n periods:

\[\text{Middle Band} = \text{SMA}(\text{Close}, n)\]

What sets them apart is the deviation: how far a fast moving average of the last m periods, with m shorter than n, lies from that middle band:

\[\text{Deviation} = \text{Middle Band} - \text{SMA}(\text{Close}, m)\]

The width of the bands is the standard deviation of that deviation over the same n periods, and the bands sit k widths above and below the middle band:

\[\text{Width} = \text{StdDev}(\text{Deviation}, n)\] \[\text{Upper Band} = \text{Middle Band} + k \cdot \text{Width}\] \[\text{Lower Band} = \text{Middle Band} - k \cdot \text{Width}\]

The fast average filters out the noise of single periods, so a one-day spike widens the Price Bands less than it widens the Bollinger Bands, and the bands react to sustained moves away from the average instead. They are read like the Bollinger Bands, but since their width follows the smoothed price, they are narrower than the Bollinger Bands of the same length and a close outside them is more common.

Also known as: PBands, smoothed Bollinger Bands.

In the Finance Toolkit this is get_bollinger_bands with method="price_bands", the same function as Bollinger Bands.

Example · USDJPY · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_bollinger_bands:

from financetoolkit import Toolkit

toolkit = Toolkit(
    tickers=["USDJPY"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.technicals.get_bollinger_bands(method="price_bands").xs("USDJPY", level=1, axis="columns")

Which returns:

References

  • Paper Bollinger, J. (2001). “Bollinger on Bollinger Bands.” McGraw-Hill.
  • Library Referenced against TTR (R)’s PBands (Price Bands)
Share