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.

Combined with RSI, Stochastic or MFI, this might be one of the most powerful strategies Gunbot has to offer. You can even combine multiple of these indicators, and run a BB-Stoch-RSI strategy, only buying or selling when multiple indicators show that momentum is about to turn.

This strategy is often combined with Stepgain, with bb as the buying strategy, then selling with stepgain.

The formula for the Bollinger Bands as calculated by Gunbot:Middle Band = SMAPERIOD simple moving average (SMA)

Upper Band = Middle Band + (SMAPERIOD standard deviation of price x STDV)

Lower Band = Middle Band – (SMAPERIOD standard deviation of price x STDV)

## Relevant indicators

## Examples

#### Pure Bollinger bands

**Scenario:** *buy at LOW_BB 5, sell at HIGH_BB 5.*

Great for relatively fast scalping, but it can be risky to just rely on Bollinger Bands. In this example, after the last buy prices dropped a lot and you have a bag to worry about.

#### Bollinger bands + Stochastic

**Scenario:** *buy at LOW_BB 5, sell at HIGH_BB 5. Additionally use STOCH_BUY_LEVEL 20 and STOCH_SELL_LEVEL 80 for confirming oversold/overbought conditions after the Bollinger Bands values have been met.*

This particular setting traded less often, but managed to find lower lows for buy orders. The gains per trade were bigger and the bot managed to sell each time.

## Strategy settings

Following settings options are available for `bb`

### Buying

These parameters control the execution of buy orders when using `bb`

as buying strategy.

Parameter | Default value | Description |
---|---|---|

`TRADING_LIMIT` |
0.002 | Values: numerical – represent an amount in primary trading currency. This value defines the trading limit for buy orders placed by Gunbot. The default value of 0.001 would place maximum orders of 0.001 BTC when used on a BTC_x pair. Only use whole numbers for fiat pairs. |

`BUY_LEVEL` |
0.1 | Values: numerical – represent a percentage. This setting can be used as protection against buying above EMA. The default value of 0.6% will prevent the bot from buying when the price is not at least 0.6 % under the lowest EMA. |

`LOW_BB` |
45 | Values: numerical – represents a percentage. This sets the target for buying with bb as buying strategy. The bot will buy when the price hits a point x% from the lower Bollinger Band. Do not use 0. |

`BUY_ENABLED` |
true | Values: true or false. Set this to false to prevent Gunbot from placing buy orders. Also affects double up orders. |

### Selling

These parameters control the execution of sell orders when using `bb`

as selling strategy.

Parameter | Default value | Description |
---|---|---|

`HIGH_BB` |
45 | Values: numerical – represents a percentage. This sets the target for selling with bb as selling strategy. The bot will sell when the price hits a point x% from the upper Bollinger Band. Do not use 0. |

`GAIN` |
0.6 | Values: numerical – represents a percentage. Used as a safety setting, defining the minimum gain of all your trades. |

`SELL_ENABLED` |
true | Values: true or false. Set this to false to prevent Gunbot from placing sell orders. |

### General

General settings for `bb`

including the relevant indicators for this strategy.

See the overview of supported periods per exchange for correctly setting `PERIOD`

.

Parameter | Default value | Description |
---|---|---|

`PERIOD` |
15 | Values: numerical – represents candlestick size in minutes. Only use supported values, see the overview linked above this table. |

`TRADING_FEES` |
0.25 | Values: numerical – represents a percentage. This sets the amount of trading fees that needs to be considered for each trade. |

`EMA1` |
16 | Values: numerical – represents an amount of candlesticks. Set this to the amount of candlesticks you want to use for your long EMA calculation. The closing price for each candle is used in the EMA calculation. For example: when you set PERIOD to 5, and want to have 2h for long EMA – you need to set EMA1 to 24 (24 * 5 mins). |

`EMA2` |
8 | Values: numerical – represents an amount of candlesticks. Set this to the amount of candlesticks you want to use for your short EMA calculation. The closing price for each candle is used in the EMA calculation. For example: when you set PERIOD to 5, and want to have 1h for short EMA – you need to set EMA2 to 12 (12 * 5 mins). |

`STDV` |
2 | Values: numerical (recommended: between 1.9 and 2.1) – represents a multiplier value used in the bollinger bands calculation. This value defines the multiplier used for calculation of the lower and upper Bollinger Bands. |

`SMAPERIOD` |
50 | *Values: numerical – represents a number of candlesticks. This parameter defines the amount of periods to be used for the simple moving average (SMA) calculation. Set this value to the value used to chart on the exchange. If you want to use SMA 50 on the exchange charts, set this value to 50. SMA is used for calculating all indicators except MFI. |

`STOP_LIMIT` |
60 | Values: numerical – represents a percentage. Sets a stop limit to sell a coin at a calculated loss. Setting a stop limit at 60 would cause that all balance for a coin are sold when the current price is >60% lower than averaged bought price. After a stop limit sell order has been placed, the bot will go into buying mode after `TRADES_TIMEOUT` has passed and will buy again when market conditions meet your buying strategy. |

`FUNDS_RESERVE` |
0.001 | Values: numerical – represent an amount in primary trading currency. Sets an amount of base currency that will not be traded with. For a BTC_x pair, funds in BTC would be reserved, for an ETH_x pair the bot will keep the amount in ETH reserved, etc. It is recommended to use the same value for all pairs you run in this base currency. |

`PANIC_SELL` |
false | Values: true or false. When set to true, all coins will be sold at market value. This can incur losses! |

`TRADES_TIMEOUT` |
0 | Values: numerical – represent time in seconds.This sets a timeout preventing any trades to be placed for a pair after the last order and after starting the bot. Use this to prevent double buys or fast consecutive buy orders when averaging down. Affects buy and sell orders. When the timeout is active you will see `Waiting to Trade - Safety Switch is on` in the logs. |

`OKKIES_MODE` |
true | Values: true or false. Setting this to true disables buy orders when there is too much price and volume pressure on BTC. Configurable with `BTC_MONEY_FLOW` . Only use this if BTC pumps have a significant effect on your trading pair. |

`BTC_MONEY_FLOW` |
35 | Values: numerical, ranging between 0 and 100.Sets the value on the Money Flow Index (MFI) you want `OKKIES_MODE` to disable buy orders. As soon as MFI hits the set value or drops below it, `OKKIES_MODE` will be enabled. |

`MIN_VOLUME_TO_BUY` |
0.001 | Values: numerical – represents the total value of a coins holdings in base currency. Sets a threshold for buy orders. If you own less than the set amount, buy orders will still be placed. This prevents owning very small quantities (dust) blocking buy orders. Only use whole numbers for fiat pairs. |

`MIN_VOLUME_TO_SELL` |
0.001 | Values: numerical – represents the total value of a coins holdings in base currency. Sets a threshold for sell orders. If you own less than the set amount, sell orders will not be placed and the bot goes into buying mode again. |

`BOUGHT_PRICE` |
Strategy dependent | Values: numerical – represent a price. Only to be used as override for pairs, use this to manually enter the last (or average) bought price when Gunbot can no longer retrieve it from the exchange |

### TrailMe!

Parameters to configure additional trailing for various types of orders.

Parameter | Default value | Description |
---|---|---|

`TRAIL_ME_BUY` |
false | Values: true or false. Use this to enable tssl-style trailing after the normal strategy buy criteria are met. |

`TRAIL_ME_SELL` |
false | Values: true or false. Use this to enable tssl-style trailing after the normal strategy sell criteria are met. |

`TRAIL_ME_DU` |
false | Values: true or false. Use this to enable tssl-style trailing for double up orders. |

`TRAIL_ME_RT` |
false | Values: true or false. Use this to enable tssl-style trailing for RT_BUY orders. |

`TRAIL_ME_BUY_RANGE` |
0.5 | Values: numerical – represent a percentage. This sets the buy range for trail me. Setting a range of 0.5% at a current price of 0.1 would set a range between 0.0995 and 0.1005. |

`TRAIL_ME_SELL_RANGE` |
0.5 | Values: numerical – represent a percentage. This sets the sell range for trail me. Setting a range of 0.5% at a current price of 0.1 would set a range between 0.0995 and 0.1005. |

### Confirming indicators

Parameters to configure additional indicators as confirmation for buying or selling. These do not apply to reversal trading or double up.

Parameter | Default value | Description |
---|---|---|

`RSI_BUY_ENABLED` |
false | Values: true or false. Setting this to true will make sure Gunbot only buys when both strategy buying conditions and `RSI_BUY_LEVEL` are met. |

`RSI_SELL_ENABLED` |
false | Values: true or false. Setting this to true will make sure Gunbot only sells when both strategy selling conditions and `RSI_SELL_LEVEL` are met. |

`RSI_BUY_LEVEL` |
30 | Values: numerical, ranging between 0 and 100. Set RSI to the maximum level you want to allow the strategy to buy at. |

`RSI_SELL_LEVEL` |
70 | Values: numerical, ranging between 0 and 100. Set RSI to the minimum level you want to allow the strategy to sell at. |

`STOCH_ENABLED` |
false | Values: true or false. Setting this to true will make sure Gunbot only trades when both strategy buying conditions and `STOCH_BUY_LEVEL` /`STOCH_SELL_LEVEL` are met. |

`STOCH_BUY_LEVEL` |
20 | Values: numerical, ranging between 0 and 100. Set Stochastic to the maximum level you want to allow the strategy to buy at. A buy signal occurs when both Stoch %K and %D are below the set buy level, additionally %K must cross over %D. |

`STOCH_SELL_LEVEL` |
80 | Values: numerical, ranging between 0 and 100. Set Stochastic to the minimum level you want to allow the strategy to sell at. A sell signal orrurs when both Stoch %K and %D are above the set sell level, additionally %K must cross down %D. |

`STOCH_K` |
14 | Values: numerical, represents a number of periods. The number of periods used for calculating Stochastic %K. |

`SLOW_STOCH_K` |
3 | Values: numerical, represents a number of periods. The number of periods used for calculating Slow Stochastic %K. |

`STOCH_D` |
3 | Values: numerical, represents a number of periods. The number of periods used for calculating Stochastic %D. |

`MFI_ENABLED` |
false | Values: true or false. Setting this to true will make sure Gunbot only sells when both strategy selling conditions and `MFI_BUY_LEVEL` /`MFI_SELL_LEVEL` are met. |

`MFI_BUY_LEVEL` |
30 | Values: numerical, ranging between 0 and 100. Set pair MFI to the maximum level you want to allow the strategy to buy at. |

`MFI_SELL_LEVEL` |
70 | Values: numerical, ranging between 0 and 100. Set pair MFI to the minimum level you want to allow the strategy to sell at. |

### Reversal trading

Settings for reversal trading.

Parameter | Default value | Description |
---|---|---|

`RT_ENABLED` |
false | Values: true or false. When set to true and prices drop, reversal trading will try to use the assets originally invested in your bag to accumulate a bigger bag, which can be sold for profit earlier than the original bag. When double up is enabled, RT will start when `DU_CAP_COUNT` is reached. |

`RT_SELL_BUYDOWN` |
1 | Values: numerical – represents a percentage.Defines the percentage drop after initial buy or RT_BUY to trigger RT_SELL. Make sure to set this higher then the spread between bid and ask to prevent unwanted buybacks. |

`RT_BUY_BUYDOWN` |
2 | Values: numerical – represents a percentage. This defines the percentage the price has to drop after RT_SELL to trigger RT_BUY. |

`AIRDROP` |
false | Values: true or false. Set this to true to enable airdrop and automatically cash out accumulated quote currency during reversal trading. The initial bag size will be kept, surplus bigger than `MIN_VOLUME_TO_SELL` will be airdropped. |

`TRADING_FEES` |
0.25 | Values: numerical – represents a percentage. This sets the amount of trading fees that needs to be considered for each trade while in reversal trading. |

`RT_MAXBAG_PROTECTION` |
10 | Values: numerical – represents a percentage. Sets the maximum difference between the average bought price and current price for starting RT. When the difference is bigger, RT won’t start. This is used as a protection against starting reversal trading on bags that already dropped too much for the process to work effectively. |

`IGNORE_TRADES_BEFORE` |
0 | Values: unix timestamp in milliseconds (in GMT)Optional parameter to force reversal trading to ignore trades before a set time. Use https://currentmillis.com/ to convert human readable time in GMT to unix timestamps, make sure to use the timestamp in milliseconds. |

### Double up

Settings for using double up.

Parameter | Default value | Description |
---|---|---|

`DOUBLE_UP` |
false | Values: true or false. When set to true, DOUBLE_UP will try to get rid of bags by averaging down. Works on all strategies. Averaging down can use up a lot of balance, make sure you have enough of your base currency available. Gunbot will start averaging down a bag according to your setting for `DU_METHOD` . |

`DU_METHOD` |
HIGHBB | Values: HIGHBB or RSI. This sets the trigger for placing buy orders with Double Up. When set to HIGHBB Gunbot will start averaging down a bag when the actual upper Bollinger Band drops below bought price (not the distance from it as set in `HIGH_BB` ), and will then buy again when the upper Bollinger Band drops below the average buy price and the price is below last buy price, as set in `DU_BUYDOWN` . When set to RSI buy orders will only be placed when the set `RSI_BUY_LEVEL` is reached and the price is below last buy price, as set in `DU_BUYDOWN` . |

`DOUBLE_UP_CAP` |
1 | Values: numerical – represents a ratio. This defines the ratio to the pairs balance to be used for each consecutive buy when doubling up. Setting it to 0.5 would mean it uses a 0.5:1 ratio for averaging down. It is recommended to set this as high as you can afford, to increase your chance to actually average down and sell at profit. Example with ratio of 1: initial buy of 100 LTC, first double up buy order is 100 LTC, second will be 200 LTC, then 400 LTC, etc. Example with 0.5 ratio: initial buy of 100 LTC, first double up buy order is 50 LTC, then 75 LTC, then 112.5 LTC. |

`DU_CAP_COUNT` |
0 | Values: numerical – represents a number. Limits the amount of times a Double Up order can be placed for a pair. The default setting of 1 would limit Double Up to only 1 buy before it waits to sell. When you set this higher, the bot will invest more and will get a lower average bought price to get rid of your bags faster. |

`DU_BUYDOWN` |
2 | Values: numerical, ranging between 0 and 100 – represents a percentage. The minimum price drop compared to last bought price that needs to occur for Double Up buys to be placed. |

`RSI_DU_BUY` |
30 | Values: numerical, ranging between 0 and 100. Use this to specify the RSI level for buying when `DU_METHOD` is set to RSI. |

### Not relevant

These settings have no function in `bb`

and act as placeholders.

Parameter | Default value | Description |
---|---|---|

`SLOW_SMA` |
1 | Placeholder. |

`FAST_SMA` |
2 | Placeholder. |

`MACD_SHORT` |
5 | Placeholder. |

`MACD_LONG` |
20 | Placeholder. |

`MACD_SIGNAL` |
10 | Placeholder. |