Skip to main content

Bollinger Bands Spot Trading Strategy

Info

Understanding Bollinger Bands Components:

  • Middle Band: A Simple Moving Average (SMA) of the price over a defined period.
  • Upper Band: The Middle Band plus a set number of standard deviations (typically two) of the price over the same period.
  • Lower Band: The Middle Band minus the same number of standard deviations. The bands widen during high volatility and narrow during low volatility.

Bollinger Bands measure volatility and highlight relative highs and lows. The indicator is built from an SMA (middle band) and upper/lower bands plotted a set number of standard deviations away from the SMA.

Traders often interpret price near the upper band as overbought and price near the lower band as oversold. In Gunbot, you configure percentages relative to the bands to trigger trades. LOW_BB defines the buy threshold from the lower band, and HIGH_BB defines the sell threshold from the upper band.

How It Works

Buy Conditions:

A buy order is considered when the price is at or below the level defined by LOW_BB (relative to the lower Bollinger Band). If the EMA filter is enabled, price must also be at least BUY_LEVEL percent below the lowest of EMA1 and EMA2. A lower LOW_BB value means closer to the lower band.

Sell Conditions:

A sell order is considered when the price is at or above the level defined by HIGH_BB (relative to the upper Bollinger Band). The profit target defined by GAIN must also be met. The HIGH_BB setting fine-tunes the sell threshold relative to the upper band.

Trading Example

Bollinger Bands strategy example showing trading performance with band-based entries and exits

Example of potential Bollinger Bands strategy performance. [_Details and settings](https://www.tradingview.com/chart/BTCUSD/4v7xtwl5-Bollinger-Bands-Gunbot-trading-strategy/)_

The infographic below describes what triggers trades with this strategy.

Bollinger Bands strategy diagram illustrating buy and sell trigger points

This diagram provides a simplified illustration. In an actual setup, conditions like BUY_LEVEL (price relative to EMAs) must also be met for a buy to trigger.

Bollinger Bands Strategy Settings

Buy Settings

LabelConfig ParameterDefault ValueDetailed Description
Buy enabledBUY_ENABLEDtrueIf enabled, allows the Bollinger Bands strategy to place buy (long) orders.
Buy levelBUY_LEVEL1An additional filter for buys: defines a percentage below the lowest of EMA1 and EMA2. A buy signal from Bollinger Bands will only be acted upon if the price is also below this EMA-defined level. Range: 0.1% to 5%.
Low BBLOW_BB0.1Defines the buy threshold as a percentage of the distance from the lower band towards the upper band. A value of 0.1 (default) means very close to the lower band. A value of 50 would target the middle band (SMA).

Sell Settings

LabelConfig ParameterDefault ValueDetailed Description
Sell enabledSELL_ENABLEDtrueIf enabled, allows the Bollinger Bands strategy to place sell (short) orders.
High BBHIGH_BB0.1Defines the sell threshold relative to the Bollinger Bands. A value of 0.1 (default) means very close to the upper band (0.1% *below* the upper band). A value of 50 would target the middle band (SMA).
GainGAIN1Defines the minimum profit percentage above the break-even point required for a sell order. Range: 0.1% to 5% (or higher if manually configured).
Count sellCOUNT_SELL9999Disables trading for the pair after a specified number of sell orders. Range: 1 to 50 (as per current doc, check if this range is accurate for your Gunbot version).

Indicators

LabelConfig ParameterDefault ValueDetailed Description
PeriodPERIOD15Defines the candlestick period (e.g., 15 minutes) used for calculating Bollinger Bands and EMAs. Ensure the chosen value (in minutes) is supported by your exchange.
SMA periodSMAPERIOD30The number of historical periods (candles) used to calculate the Simple Moving Average (SMA), which forms the middle line of the Bollinger Bands.
Standard deviationSTDV2The number of standard deviations to plot the upper and lower bands away from the SMA. Common values are 1 to 3. Higher values result in wider bands.
Medium EMAEMA116The number of periods for the medium-term Exponential Moving Average (EMA1), used as an optional filter with BUY_LEVEL.
Fast EMAEMA28The number of periods for the short-term (fast) Exponential Moving Average (EMA2), used as an optional filter with BUY_LEVEL.

Overview of Effects on Different Order Types

Config ParameterAffected Order TypesNot Affected Order Types
Buy EnabledStrategy buy, DCA buy, RT buy, RT buybackStrategy sell, Stop limit, Close, RT sell
Buy LevelStrategy buyStrategy sell, Stop limit, Close, RT sell, DCA buy, RT buy, RT buyback
Sell EnabledStrategy sell, Stop limit, RT sellStrategy buy, RT buy, RT buyback, Close, DCA buy
GainStrategy sellStrategy buy, RT buy, RT buyback, RT sell, Close, DCA buy, Stop limit
PeriodStrategy sell, Strategy buy, DCA buy (when using an indicator)RT buy, RT buyback, RT sell, Close, Stop limit
Low BBStrategy buyRT buy, RT buyback, RT sell, Close, Stop limit, Strategy sell, DCA buy
High BBStrategy sell, DCA buy (when using HIGHBB option)RT buy, RT buyback, RT sell, Close, Stop limit, Strategy buy
SMA PeriodStrategy sell, Strategy buy, DCA buy (when using HIGHBB option)RT buy, RT buyback, RT sell, Close, Stop limit
Standard DeviationStrategy sell, Strategy buy, DCA buy (when using HIGHBB option)RT buy, RT buyback, RT sell, Close, Stop limit
Slow EMAStrategy buyRT buy, RT buyback, RT sell, Close, Stop limit, Strategy sell, DCA buy
Medium EMAStrategy buyRT buy, RT buyback, RT sell, Close, Stop limit, Strategy sell, DCA buy