# Bollinger Bands (TA)

[Bollinger Bands](https://en.wikipedia.org/wiki/Bollinger_Bands) indicate relative high and low prices, using this information you can buy relatively low and sell relatively high.

With this strategy you can configure at which percentage from the lower Bollinger Band Gunbot should buy, and at which percentage from the upper Bollinger Band a sell order should be placed. Orders are placed after prices first move outside the set level, then move back in.

{% hint style="info" %}
Some extra features are available for users of Gunbot Standard edition and higher. These are marked below.
{% endhint %}

{% hint style="warning" %}
Gain protection is optional for this strategy.

Be aware that this can lead to sell orders below your break-even point.
{% endhint %}

## Trading example

![](https://user-images.githubusercontent.com/2372008/47218852-65788400-d3ad-11e8-8100-1ab21cbc70dd.PNG)

*Example of how trading with this strategy can perform.* [*Details and settings*](https://www.tradingview.com/chart/EOSUSDT/L6342dzc-Bollinger-Bands-TA-Gunbot-trading-strategy/)

## How to work with this strategy

The infographic below describes what triggers trades with this strategy.

![](https://user-images.githubusercontent.com/2372008/40925897-196d6510-681b-11e8-94ac-99757f46ab7b.PNG)

## Strategy parameters

Following settings options are available for `BBTA` and can be set in the strategy configurator of the GUI or the strategies section of the config.js file.

These settings are global and apply to all pairs running this strategy. When you want a specific parameter to be different for one or more pairs, use an override at the pair level.

Using the `BUY_METHOD` and `SELL_METHOD` parameters you can combine different methods for buying and selling. This strategy page assumes both `BUY_METHOD` and `SELL_METHOD` are set to `BBTA`. Accepted values are all strategy names as listed [here.](/wiki/trading-strategy-options/about-gunbot-strategies/trading-methods.md#available-buy-and-sell-methods)

## Buy settings

Buy settings are the primary trigger for buy orders. These parameters control the execution of buy orders when using `BBTA` as buy method.

Take Buy is only available for Gunbot Standard and higher.

### Buy enabled

{% tabs %}
{% tab title="Description" %}
Set this to false to prevent Gunbot from placing buy orders.
{% endtab %}

{% tab title="Values" %}
**Values:** true or false

**Default value:** true
{% endtab %}

{% tab title="Order types" %}

| Affects      | Does not affect |
| ------------ | --------------- |
| Strategy buy | Strategy sell   |
| DCA buy      | Stop limit      |
| RT buy       | Close           |
| RT buyback   | RT sell         |
| {% endtab %} |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `BUY_ENABLED`
{% endtab %}
{% endtabs %}

### NBA

{% tabs %}
{% tab title="Description" %}
"Never Buy Above". Use this to only allow buy orders below the last sell rate.

This sets the minimum percentage difference between the last sell order and the next buy. The default setting of 0 disables this option.

When set to 1, Gunbot will only place a buy order when the strategy buy criteria meet and price is at least 1% below the last sell price.
{% endtab %}

{% tab title="Values" %}
**Values:** numerical, represents a percentage.

**Default value:** 0
{% endtab %}

{% tab title="Order types" %}

| Affects      | Does not affect |
| ------------ | --------------- |
| Strategy buy | Strategy sell   |
|              | Stop limit      |
|              | Close           |
|              | RT sell         |
|              | DCA buy         |
|              | RT buy          |
|              | RT buyback      |
| {% endtab %} |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `NBA`
{% endtab %}
{% endtabs %}

### Take Buy

{% tabs %}
{% tab title="Description" %}
With this setting enabled, Gunbot will try to take any buy chance between the strategy entry point and your setting for `TBUY_RANGE`.

As soon as the ask price drops below the upper border of this range (called "Take Buy"), it will trail down with a range of `TBUY_RANGE` and place a buy order as soon as the ask price crosses up "Take Buy". Confirming indicators in use are respected.

Normal strategy buy orders are still possible while using `TAKE_BUY`.

This option should not be used together with reversal trading.
{% endtab %}

{% tab title="Values" %}
**Values:** true or false

**Default value:** false
{% endtab %}

{% tab title="Order types" %}

| Affects      | Does not affect |
| ------------ | --------------- |
| Strategy buy | Strategy sell   |
|              | Stop limit      |
|              | Close           |
|              | RT sell         |
|              | DCA buy         |
|              | RT buy          |
|              | RT buyback      |
| {% endtab %} |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `TAKE_BUY`
{% endtab %}
{% endtabs %}

### TBuy Range

{% tabs %}
{% tab title="Description" %}
This sets the buy range for `TAKE_BUY`.

When set to 0.5, the initial trailing stop is set 0.5% above the entry point defined by `BUY_LEVEL`.
{% endtab %}

{% tab title="Values" %}
**Values:** numerical, represents a percentage.

**Default value:** 0.5
{% endtab %}

{% tab title="Order types" %}

| Affects      | Does not affect |
| ------------ | --------------- |
| Strategy buy | Strategy sell   |
|              | Stop limit      |
|              | Close           |
|              | RT sell         |
|              | DCA buy         |
|              | RT buy          |
|              | RT buyback      |
| {% endtab %} |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `TBUY_RANGE`
{% endtab %}
{% endtabs %}

### Buy Level

{% tabs %}
{% tab title="Description" %}
This sets entry point for `TAKE_BUY` at a percentage below the lowest EMA.

When you set this to 1, the entry point will be set 1% below the currently lowest EMA.
{% endtab %}

{% tab title="Values" %}
**Values:** numerical, represents a percentage.

**Default value:** 1
{% endtab %}

{% tab title="Order types" %}

| Affects      | Does not affect |
| ------------ | --------------- |
| Strategy buy | Strategy sell   |
|              | Stop limit      |
|              | Close           |
|              | RT sell         |
|              | DCA buy         |
|              | RT buy          |
|              | RT buyback      |
| {% endtab %} |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `BUY_LEVEL`
{% endtab %}
{% endtabs %}

## Sell settings

Sell settings are the primary trigger for sell orders. These parameters control the execution of sell orders when using `BBTA` as sell method.

### Sell enabled

{% tabs %}
{% tab title="Description" %}
Set this to false to prevent Gunbot from placing sell orders.
{% endtab %}

{% tab title="Values" %}
**Values:** true or false

**Default value:** true
{% endtab %}

{% tab title="Order types" %}

| Affects       | Does not affect |
| ------------- | --------------- |
| Strategy sell | Strategy buy    |
| Stop limit    | RT buy          |
| RT sell       | RT buyback      |
|               | Close           |
|               | DCA buy         |
| {% endtab %}  |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `SELL_ENABLED`
{% endtab %}
{% endtabs %}

### Take Profit

{% tabs %}
{% tab title="Description" %}
With this setting enabled, Gunbot will try to take any possible profit between the break-even point and your strategy exit point. This can be useful, for example, on days where the markets move very slowly.

It works by trailing prices upwards between the break-even point and the strategy exit point, with a configurable range for trailing: `TP_RANGE`. A sell order will be placed when the trailing stop limit is hit or strategy sell conditions are reached. Confirming indicators in use are respected.

Sells at minimal loss are possible when using `TAKE_PROFIT`, acting as a sort of mini stop loss.

This option should not be used together with reversal trading or `DOUBLE_CHECK_GAIN`
{% endtab %}

{% tab title="Values" %}
**Values:** true or false

**Default value:** false
{% endtab %}

{% tab title="Order types" %}

| Affects       | Does not affect |
| ------------- | --------------- |
| Strategy sell | Strategy buy    |
|               | RT buy          |
|               | RT buyback      |
|               | RT sell         |
|               | Close           |
|               | DCA buy         |
|               | Stop limit      |
|               |                 |
| {% endtab %}  |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `TAKE_PROFIT`
{% endtab %}
{% endtabs %}

### TP Range

{% tabs %}
{% tab title="Description" %}
This sets the sell range for `TAKE_PROFIT`.

When set to 0.5, the initial trailing stop is set 0.5% below the break-even point.
{% endtab %}

{% tab title="Values" %}
**Values:** numerical – represents a percentage.

**Default value:** 0.5
{% endtab %}

{% tab title="Order types" %}

| Affects       | Does not affect |
| ------------- | --------------- |
| Strategy sell | Strategy buy    |
|               | RT buy          |
|               | RT buyback      |
|               | RT sell         |
|               | Close           |
|               | DCA buy         |
|               | Stop limit      |
|               |                 |
| {% endtab %}  |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `TP_RANGE`
{% endtab %}
{% endtabs %}

### TP Profit Only

{% tabs %}
{% tab title="Description" %}
Enable this to only allow sell orders above the break-even point.
{% endtab %}

{% tab title="Values" %}
**Values:** true or false

**Default value:** false
{% endtab %}

{% tab title="Order types" %}

| Affects       | Does not affect |
| ------------- | --------------- |
| Strategy sell | Strategy buy    |
|               | RT buy          |
|               | RT buyback      |
|               | RT sell         |
|               | Close           |
|               | DCA buy         |
|               | Stop limit      |
|               |                 |
| {% endtab %}  |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `TP_PROFIT_ONLY`
{% endtab %}
{% endtabs %}

### Double Check Gain

{% tabs %}
{% tab title="Description" %}
Disable this to allow sell orders below the break-even point.
{% endtab %}

{% tab title="Values" %}
**Values:** true or false

**Default value:** true
{% endtab %}

{% tab title="Order types" %}

| Affects       | Does not affect |
| ------------- | --------------- |
| Strategy sell | Strategy buy    |
|               | RT buy          |
|               | RT buyback      |
|               | RT sell         |
|               | Close           |
|               | DCA buy         |
|               | Stop limit      |
|               |                 |
| {% endtab %}  |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `DOUBLE_CHECK_GAIN`
{% endtab %}
{% endtabs %}

### Gain

{% tabs %}
{% tab title="Description" %}
This sets the minimum target for selling when `DOUBLE_CHECK_GAIN` is enabled.
{% endtab %}

{% tab title="Values" %}
**Values:** numerical – represents a percentage.

**Default value:** 0.5
{% endtab %}

{% tab title="Order types" %}

| Affects       | Does not affect |
| ------------- | --------------- |
| Strategy sell | Strategy buy    |
|               | RT buy          |
|               | RT buyback      |
|               | RT sell         |
|               | Close           |
|               | DCA buy         |
|               | Stop limit      |
|               |                 |
| {% endtab %}  |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `GAIN`
{% endtab %}
{% endtabs %}

## Indicator settings

Relevant indicators for trading with BBTA

These settings have a direct effect on trading with `BBTA`.

### Period

{% tabs %}
{% tab title="Description" %}
This sets the candlestick period used for trading, this affects all indicators within the strategy.

Only use [supported values](/wiki/how-to-work-with-gunbot/basic-workings/period.md#supported-period-values).

Setting a short period allows you to trade on shorter trends, but be aware that these will be noisier than longer periods.
{% endtab %}

{% tab title="Values" %}
**Values:** numerical– represents candlestick size in minutes.

**Default value:** 15
{% endtab %}

{% tab title="Order types" %}

| Affects                                      | Does not affect |
| -------------------------------------------- | --------------- |
| Strategy sell                                | RT buy          |
| Strategy buy                                 | RT buyback      |
| DCA buy (when using an indicator to trigger) | RT sell         |
|                                              | Close           |
|                                              | Stop limit      |
| {% endtab %}                                 |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `PERIOD`
{% endtab %}
{% endtabs %}

### Low BB

{% tabs %}
{% tab title="Description" %}
This sets the target for buying. Negative values are allowed.

The bot will buy after prices first move under the set % from the lower Bollinger Band, then cross over the set level.

When set to 0, the lower Bollinger Band is the target. When set to 30, the target is 30% above the lower Bollinger Band - the upper band is at 100% from the lower band. Negative values are allowed.
{% endtab %}

{% tab title="Values" %}
**Values:** numerical – represents a percentage.

**Default value:** 0
{% endtab %}

{% tab title="Order types" %}

| Affects      | Does not affect |
| ------------ | --------------- |
| Strategy buy | RT buy          |
|              | RT buyback      |
|              | RT sell         |
|              | Close           |
|              | Stop limit      |
|              | Strategy sell   |
|              | DCA buy         |
| {% endtab %} |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `LOW_BB`
{% endtab %}
{% endtabs %}

### High BB

{% tabs %}
{% tab title="Description" %}
This sets the target for selling. Negative values are allowed.

The bot will sell after prices first move over the set % from the upper Bollinger Band, then cross down the set level. Additionally `GAIN` must be reached.

When set to 0, the upper Bollinger Band is the target. When set to 30, the target is 30% under the upper Bollinger Band - the lower band is at 100% from the upper band. Negative values are allowed.
{% endtab %}

{% tab title="Values" %}
**Values:** numerical – represents a percentage.

**Default value:** 0
{% endtab %}

{% tab title="Order types" %}

| Affects                                    | Does not affect |
| ------------------------------------------ | --------------- |
| Strategy sell                              | RT buy          |
| DCA buy (when using HIGHBB option for DCA) | RT buyback      |
|                                            | RT sell         |
|                                            | Close           |
|                                            | Stop limit      |
|                                            | Strategy buy    |
| {% endtab %}                               |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `HIGH_BB`
{% endtab %}
{% endtabs %}

### SMA Period

{% tabs %}
{% tab title="Description" %}
This defines the number of periods used for calculating Bollinger Bands.
{% endtab %}

{% tab title="Values" %}
**Values:** numerical – represents a number of candlesticks.

**Default value:** 50
{% endtab %}

{% tab title="Order types" %}

| Affects                                    | Does not affect |
| ------------------------------------------ | --------------- |
| Strategy sell                              | RT buy          |
| Strategy buy                               | RT buyback      |
| DCA buy (when using HIGHBB option for DCA) | RT sell         |
|                                            | Close           |
|                                            | Stop limit      |
| {% endtab %}                               |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `SMAPERIOD`
{% endtab %}
{% endtabs %}

### Standard Deviation

{% tabs %}
{% tab title="Description" %}
This value defines the multiplier used for calculating Bollinger Bands.
{% endtab %}

{% tab title="Values" %}
**Values:** numerical (recommended: between 1.9 and 2.1) - represents a multiplier value used in the bollinger bands calculation.

**Default value:** 2
{% endtab %}

{% tab title="Order types" %}

| Affects                                    | Does not affect |
| ------------------------------------------ | --------------- |
| Strategy sell                              | RT buy          |
| Strategy buy                               | RT buyback      |
| DCA buy (when using HIGHBB option for DCA) | RT sell         |
|                                            | Close           |
|                                            | Stop limit      |
| {% endtab %}                               |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `STDV`
{% endtab %}
{% endtabs %}

### Slow EMA

{% tabs %}
{% tab title="Description" %}
Set this to the amount of candlesticks you want to use for your slow EMA. The closing price for each candle is used in the slow EMA calculation.

For example: when you set `PERIOD` to 5, and want to use 2h for slow EMA – you need to set `EMA1` to 24 (24 \* 5 mins).
{% endtab %}

{% tab title="Values" %}
**Values:** numerical – represents a number of candlesticks.

**Default value:** 16
{% endtab %}

{% tab title="Order types" %}

| Affects      | Does not affect |
| ------------ | --------------- |
| Strategy buy | RT buy          |
|              | RT buyback      |
|              | RT sell         |
|              | Close           |
|              | Stop limit      |
|              | Strategy sell   |
|              | DCA buy         |
| {% endtab %} |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `EMA1`
{% endtab %}
{% endtabs %}

### Medium EMA

{% tabs %}
{% tab title="Description" %}
Set this to the amount of candlesticks you want to use for your medium EMA. The closing price for each candle is used in the fast EMA calculation.

For example: when you set `PERIOD` to 5, and want to use 1h for medium EMA – you need to set `EMA2` to 12 (12 \* 5 mins).
{% endtab %}

{% tab title="Values" %}
**Values:** numerical – represents a number of candlesticks.

**Default value:** 8
{% endtab %}

{% tab title="Order types" %}

| Affects      | Does not affect |
| ------------ | --------------- |
| Strategy buy | RT buy          |
|              | RT buyback      |
|              | RT sell         |
|              | Close           |
|              | Stop limit      |
|              | Strategy sell   |
|              | DCA buy         |
| {% endtab %} |                 |

{% tab title="Name" %}
Parameter name in `config.js`: `EMA2`
{% endtab %}
{% endtabs %}

## TrailMe settings

{% hint style="info" %}
This is not available for Gunbot Starter.
{% endhint %}

Parameters to configure additional trailing for various types of orders. Trailing works just like it does for the TSSL strategy, the difference being the starting point of trailing.

Orders resulting from trailing are only placed when the main strategy criteria are met, and confirming indicators (if any) allow the order. All these conditions must occur in the same cycle.

Because this strategy trades on crosses happening in a single cycle, it is not recommended to use additional trailing for normal buy and sell orders. Trades will only happen when both the trailing stop and strategy cross happen in the same round.

{% content-ref url="/pages/-LdImDes90oTiTX1\_cN0" %}
[TrailMe](/wiki/trading-strategy-options/trailme.md)
{% endcontent-ref %}

## Balance settings

{% content-ref url="/pages/-LdImDeo7cuhK6swFdm8" %}
[Balance settings](/wiki/trading-strategy-options/balance-settings.md)
{% endcontent-ref %}

## Confirming indicator + advanced indicator settings

{% hint style="info" %}
This is not available for Gunbot Starter.
{% endhint %}

{% content-ref url="/pages/-LdImDepHj\_60UR6\_wOq" %}
[Confirming indicators](/wiki/trading-strategy-options/confirming-indicators.md)
{% endcontent-ref %}

## Dollar cost avg settings

{% hint style="info" %}
This is not available for Gunbot Starter.
{% endhint %}

{% content-ref url="/pages/-LdImDeq-khvOlP-iu-u" %}
[Dollar Cost Avg (DCA)](/wiki/trading-strategy-options/dollar-cost-avg-dca.md)
{% endcontent-ref %}

## Reversal trading settings

{% hint style="info" %}
This is not available for Gunbot Starter.
{% endhint %}

{% content-ref url="/pages/-LdImDer8NYjL6noX8I1" %}
[Reversal trading (RT)](/wiki/trading-strategy-options/reversal-trading-rt.md)
{% endcontent-ref %}

## Misc settings

{% content-ref url="/pages/-LdImDetHjnk2MHsgMk6" %}
[Misc settings](/wiki/trading-strategy-options/misc-settings.md)
{% endcontent-ref %}

## Placeholders

The following parameters in `config.js` have no function for this strategy and act as placeholder.

| Parameter             | Description  |
| --------------------- | ------------ |
| `ATRX`                | Placeholder. |
| `ATR_PERIOD`          | Placeholder. |
| `BUYLVL1`             | Placeholder. |
| `BUYLVL2`             | Placeholder. |
| `BUYLVL3`             | Placeholder. |
| `BUYLVL`              | Placeholder. |
| `BUY_RANGE`           | Placeholder. |
| `DISPLACEMENT`        | Placeholder. |
| `FAST_SMA`            | Placeholder. |
| `ICHIMOKU_PROTECTION` | Placeholder. |
| `KIJUN_CLOSE`         | Placeholder. |
| `KIJUN_PERIOD`        | Placeholder. |
| `KIJUN_STOP`          | Placeholder. |
| `KUMO_CLOSE`          | Placeholder. |
| `KUMO_SENTIMENTS`     | Placeholder. |
| `KUMO_STOP`           | Placeholder. |
| `LEVERAGE`            | Placeholder. |
| `LONG_LEVEL`          | Placeholder. |
| `MACD_LONG`           | Placeholder. |
| `MACD_SHORT`          | Placeholder. |
| `MACD_SIGNAL`         | Placeholder. |
| `MAKER_FEES`          | Placeholder. |
| `MEAN_REVERSION`      | Placeholder. |
| `PP_BUY`              | Placeholder. |
| `PP_SELL`             | Placeholder. |
| `PRE_ORDER_GAP`       | Placeholder. |
| `PRE_ORDER`           | Placeholder. |
| `RENKO_ATR`           | Placeholder. |
| `RENKO_BRICK_SIZE`    | Placeholder. |
| `RENKO_PERIOD`        | Placeholder. |
| `ROE_CLOSE`           | Placeholder. |
| `ROE_LIMIT`           | Placeholder. |
| `ROE_TRAILING`        | Placeholder. |
| `ROE`                 | Placeholder. |
| `SELLLVL1`            | Placeholder. |
| `SELLLVL2`            | Placeholder. |
| `SELLLVL3`            | Placeholder. |
| `SELLLVL`             | Placeholder. |
| `SELL_RANGE`          | Placeholder. |
| `SENKOUSPAN_PERIOD`   | Placeholder. |
| `SHORT_LEVEL`         | Placeholder. |
| `SLOW_SMA`            | Placeholder. |
| `TENKAN_CLOSE`        | Placeholder. |
| `TENKAN_PERIOD`       | Placeholder. |
| `TENKAN_STOP`         | Placeholder. |
| `TSSL_TARGET_ONLY`    | Placeholder. |
| `USE_RENKO`           | Placeholder. |


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gunthy.gitbook.io/wiki/trading-strategy-options/regular-strategies-spot-trading/bollinger-bands-ta.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
