Skip to main content

Bollinger Bands TA

This page describes how futures trading works with the Bollinger Bands TA strategy. The triggers for trades are slightly different than in the same strategy for regular trading.

How to work with this strategy#

Gunbot will open one position, either long or short, and close this position when the target is reached. When the stop is hit before profitably closing a trade, Gunbot will place a stop order at loss. After closing a position, Gunbot will again look to open a new long or short position. Gunbot will not add to existing open positions.

Please don't manually add to or reduce positions opened by Gunbot, unless you stop running Gunbot on this trading pair until you've closed this position.

The examples below show how the basic triggers for BBTA work. Additionally, you can use confirming indicators and settings like ROE trailing.

Long#

  • A long position is opened when the ask price crosses over LOW_BB. In the example above LOW_BB would be set to 0, which represents the actual lower Bollinger Band. With different values you could set a target above (positive value) or below (negative value) the lower band.
  • Position is closed when the desired ROE (return on equity) is reached. This is a percentage from the entry point, taking leverage into consideration.
  • A position is closed at loss when a stop is hit.

Short#

  • A short position is opened when the bid price crosses below HIGH_BB. In the example above HIGH_BB would be set to 0, which represents the actual upper Bollinger Band. With different values you could set a target below (positive value) or above (negative value) the upper band.
  • Position is closed when the desired ROE (return on equity) is reached. This is a percentage from the entry point, taking leverage into consideration.
  • A position is closed at loss when a stop is hit.

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.

Margin settings#

Margin settings control settings like leverage and the target for ROE. These parameters are relevant when using BBTA as buy and/or sell method.

ROE#

This sets the target for closing a position.

ROE is the Return On Equity for a position, the percentage profit and loss on your invested margin. This value is calculated in a similar way to how Bitmex calculates it, it does include leverage and does not include fees.

Examples:

Long position, 1x leverage.
When price moves 1% above the average entry price, 1% ROE is reached.

Long position, 100x leverage (or cross leverage).
When price moves 1% above the average entry price, 100% ROE is reached.

Short position, 20x leverage
When price moves 1% below the average entry price, 20% ROE is reached.


PND#

Use "PND" logic to close trades. This mode tries to not close a position before a pump or dump has fully played out - usually beats ROE trailing performance.

Respects the minimum ROE set.


PND protection#

Threshold to close a position when it drops below ROE again.

A value of 1.5 means that if ROE reached 1.5x the minimum target, the position will get closed immediately if the trend turns.


Leverage#

Sets the leverage for opening any position. Setting 0 places the order with cross margin.

{% hint style="warning" %} On Binance Futures you must set leverage per pair on the exchange itself. :::


Stop Buy#

Places a market stop order for a long position, at the same time as the position is opened.

When set to 1 and a long order is opened at a price of 100, a stop market order will be placed at 99.

tip

This setting is exclusive to Bitmex


Stop Sell#

Places a market stop order for a short position, at the same time as the position is opened.

When set to 1 and a short order is opened at a price of 100, a stop market order will be placed at 101.

tip

This setting is exclusive to Bitmex


ROE Trailing#

Use this to enable tssl-style trailing for ROE.

Trailing limit is set with ROE_LIMIT.


ROE Scalper#

Use this to enable an alternate trailing mechanism for closing positions.

Trailing limit is set with ROE_LIMIT. Additionally ROE_TRAILING must be enabled.


ROE Limit#

This sets the range for ROE trailing.

ROE trailing:

Range is a percentage of current ROE. Setting a ROE_LIMIT of 5 at a ROE target of 1 would set an initial range between 0.95 and 1.05.

ROE scalper:

Range is an absolute ROE value. Setting a ROE_LIMIT of 5 at a ROE target of 10 means that the trailing stop is initially set at ROE 5 (ROE minus ROE_LIMIT).

Both:

As long as ROE keeps increasing, the range moves along with ROE. As soon as ROE start decreasing, the lower range gets frozen. A close order is placed when ROE crosses the lower limit.


Pre Order#

When set to true, limit orders will placed at a configurable rate beyond the best bid/ask price to get ahead of the order book.


Pre Order Gap#

Sets the gap between the best bid/ask price in the orderbook and the rate at which a limit order gets placed. Long orders are placed at ask + gap. Short orders are placed at bid - gap.

It is possible to use negative values, this will increase the chance of receiving maker fees.

Example when set to 1 and a buy signal occurs at an ask price of 100: a limit order gets placed at a rate of 101. When set to -1 and a buy signal occurs at an ask price of 100: a limit order gets placed at a rate of 99.

Don't use a negative gap together with STOP_BUY and/or STOP_SELL, as these stops do not combine well with position that do not always fill. Instead use STOP_LIMIT.


Buy settings#

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

Buy enabled#

Set this to false to prevent Gunbot from placing buy orders.


NBA#

"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.


Sell settings#

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

Sell enabled#

Set this to false to prevent Gunbot from placing sell orders.


Indicator settings#

Relevant indicators for trading with BBTA.

These settings have a direct effect on trading with BBTA, this is where you configure how Bollinger Bands are calculated and at which distance from them orders should be placed.

Period#

This sets the candlestick period used for trading, this affects all indicators within the strategy.

Only use supported values.

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


Low BB#

This sets the target for buying. Negative values are allowed.

The bot will buy when price hits the set percentage from the lower Bollinger Band.

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.


High BB#

This sets the target for selling. Negative values are allowed.

The bot will sell when price hits the set percentage from the upper Bollinger Band and GAIN is reached.

When set to 0, the upper Bollinger Band is the target (well, almost). 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.


SMA Period#

This defines the number of periods used for calculating Bollinger Bands.


Standard Deviation#

This value defines the multiplier used for calculating Bollinger Bands.


Slow EMA#

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).


Medium EMA#

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).


Balance settings#

Balance settings

Confirming indicators + advanced indicator settings#

Confirming indicators

Misc settings#

Misc settings

Dollar cost avg settings#

DCA Method#

When set to TENKAN Gunbot will place DCA orders in exactly the same way as in the Tenkan strategy. Each DCA order is in size of TRADING_LIMIT.


Reversal trading settings#

RT is not intented to be used for futures trading.

TrailMe settings#

TrailMe is not intended to be used with this strategy.

Placeholders#

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

ParameterDescription
ATRXPlaceholder.
ATR_PERIODPlaceholder.
BUYLVL1Placeholder.
BUYLVL2Placeholder.
BUYLVL3Placeholder.
BUYLVLPlaceholder.
BUY_LEVELPlaceholder.
BUY_RANGEPlaceholder.
DISPLACEMENTPlaceholder.
DOUBLE_CHECK_GAINPlaceholder.
FAST_SMAPlaceholder.
GAINPlaceholder.
ICHIMOKU_PROTECTIONPlaceholder.
KIJUN_BUYPlaceholder.
KIJUN_CLOSEPlaceholder.
KIJUN_PERIODPlaceholder.
KIJUN_SELLPlaceholder.
KIJUN_STOPPlaceholder.
KUMO_BUYPlaceholder.
KUMO_CLOSEPlaceholder.
KUMO_SELLPlaceholder.
KUMO_SENTIMENTSPlaceholder.
KUMO_STOPPlaceholder.
LONG_LEVELPlaceholder.
MACD_LONGPlaceholder.
MACD_SHORTPlaceholder.
MACD_SIGNALPlaceholder.
MEAN_REVERSIONPlaceholder.
PP_BUYPlaceholder.
PP_SELLPlaceholder.
RENKO_ATRPlaceholder.
RENKO_BRICK_SIZEPlaceholder.
RENKO_PERIODPlaceholder.
SELLLVL1Placeholder.
SELLLVL2Placeholder.
SELLLVL3Placeholder.
SELLLVLPlaceholder.
SELL_RANGEPlaceholder.
SENKOUSPAN_PERIODPlaceholder.
SHORT_LEVELPlaceholder.
SLOW_SMAPlaceholder.
TAKE_BUYPlaceholder.
TBUY_RANGEPlaceholder.
TENKAN_BUYPlaceholder.
TENKAN_CLOSEPlaceholder.
TENKAN_PERIODPlaceholder.
TENKAN_SELLPlaceholder.
TENKAN_STOPPlaceholder.
TP_PROFIT_ONLYPlaceholder.
TP_RANGEPlaceholder.
TSSL_TARGET_ONLYPlaceholder.
USE_RENKOPlaceholder.