> For the complete documentation index, see [llms.txt](https://docs.stockhero.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stockhero.ai/technical-indicators/bollinger-band.md).

# Bollinger Band

The Bollinger Bands (BB) were created in the early 1980s by financial analyst and trader John Bollinger. Bollinger Bands work as oscillators. It indicates whether the market has high or low volatility, as well as overbought or oversold conditions.&#x20;

{% hint style="info" %}
StockHero Bollinger Band: a buy signal is generated when the candlestick data reaches an oversold region, and a sell signal is generated when it reaches an overbought region.
{% endhint %}

![](https://4210655246-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5LiMstpewrLGU6auaX%2F-M64F4B3n4bQbn0XA8jk%2F-M64Hd5Tv5Qm7ctlwfjC%2FScreenshot%202020-04-29%20at%205.35.11%20PM.png?alt=media\&token=30024de2-dfbb-4e66-82bc-869224e170ec)

The core concept behind the BB indicator is to highlight how prices are dispersed around an average value. More specifically, it is composed of an upper band (red), a lower band (yellow), and a middle band (blue), also known as the middle moving average line. The two sidelong bands react to the market price action, expanding when the volatility is high, moving away from the middle line, and contracting when the volatility is low, moving towards the middle line.

```
Middle line = (SMA, n)
Upper band = (SMA, n) + (20-day standard deviation * y)
Lower band = (SMA, n) - (20-day standard deviation * y)

Where: 
n = Time Period
y = standard deviation multiplier
```

The standard Bollinger Bands formula sets the middle line as an X-day Simple Moving Average (SMA), while the upper and lower bands are calculated based on market volatility in relation to the SMA, which is referred to as the standard deviation.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stockhero.ai/technical-indicators/bollinger-band.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
