Bitcoin Live-Trading Profitable Hybrid Strategy with Cointegration, Bollinger Bands and Keltner Channels

Thomas Huault
Superalgos | Algorithmic Trading
8 min readJan 25, 2022

A trading strategy ran live with Superalgos and broadcasting trading signals over a Telegram Bot

Photo by Subham Dhage at Unsplash

Superalgos is THE social trading platform. It is designed to produce, gather and diffuse trading intelligence amongst the widest possible population in a permissionless and censorship resitant way. It has no equivalent and no other bot, paid or free, has the same huge innovation potential and refined architecture. So what could be the best way to demonstrate what is possible to achieve with it? Create a strategy, demonstrate the performances and share the results with the whole world in a signal broadcasting Telegram bot!

In this article we will present a strategy based on the self cointegration indicator, available at Quasar data mine in Superalgos, Bollinger Bands and Keltner channels. In a first time we will briefly introduce the different indicators, then the strategy, and finally describe the Telegram Bot broadcasting trading signals.

Indicators Description

The strategy we developed here relies on three indicators: the self cointegration, the Bollinger bands and the Keltner channels.

Self Cointegration Indicator

Cointegration is a statistical property of time series used in financial analysis. It describes long term relationship between two time series by an analysis of the low order of integrations of linear combination of the said time series. Using the same signal with the periodic return averaged over two different time windows we can create a self cointegration indicator, describing the relationship between the price an itself over a different period of time allowing a leading highlighting of possible reversions.

The self cointegration indicator integrated at Quasar data mine in Superalgos uses the Engle and Granger 2 steps approach to establish a cointegration factor.

BTC/USDT at 01-hs timeframe with self cointegration indicator

The indicator in Superalgos is designed as an oscillating blue line with one green line at +1 and one red line at -1, showing respectively opportunities of entry points for long position whenever the blue line is below the red line, and short position if the blue line is above the red line.

The Bollinger Bands Indicator

Bollinger bands are a volatility-based indicator constituted from a simple moving average, generally over 20 periods, surrounded by two bands situated at twice the standard deviation of the typical price HLC3 (Max + Min + Close)/3.

The bands are designed by initially calculating the SMA20 like:

From which we can deduce the standard deviation:

The upper and lower bands are then calculated like:

Bollinger Bands of the BTC/USDT pair on the 1-hs chart plotted using Superalgos

Keltner Channels

Keltner channels use a measure of the volatility to frame price movements around an exponential moving average. To evaluate the channels, we fist calculate an EMA20:

With s = 2 and P = 20.

The position of the bands is determined by the Average True Range, a moving average of the True Range:

The ATR is calculated as 10 periods moving average of TR:

The Keltner channels are calculated at twice the ATR above and below the EMA20:

Keltner Channels of the BTC/USDT pair using Superalgos on the 1-hs timescale chart

Building the Strategy

The strategy we intend to trade uses 3 indicators. We called it a hybrid strategy since it will use different types of conditions with different indicators between opening and closing stage.

Position Opening with Self-Cointegration

To enter a trade, we are looking for the moments when the trend is the most inclined to reverse. Cointegration is the indicator we can use while trading mean reversion patterns, i.e. it will indicate when the price leaves the moving average and actually when it will go back to it. For the purpose of this strategy, we use it as a self-cointegration with a 15-periods and a 200-periods moving average of the price, so we are looking for their long term relationship and the points where they will cross with high potential for positive return.

We set our trading system to fire a Buy Market order whenever the self-cointegration coefficient is below -1 and its slope becomes positive on the 3-hours timeframe.

BTC/USDT candles on 1-hs timeframe with self-cointegration indicator ; green arrows point at trading opportunities

Two Situations Close the Position with Profits

The closing stage for profit generation of the trades is organized according to two situations.

The opening of the position does not consider anything else but mean reversion opportunities, so the bot will open a position whatever the situation of the market in terms of long term trends, observed volatility and volumes. That means trades will be opened independently of the regular trading patterns like Bollinger bands quenching, contrarian signals, over-bought/sell momentums… with the evident drawback of the risk of false signals but the big advantage of a bigger number of trading opportunities. The closing stage considers this particular philosophy, seeking for the most profitable outcome while having to manage precisely the bad outcomes.

The profitable targeted situation will take advantage of the price situation within Bollinger bands while being confirmed with Keltner channels.

The most profitable situation will be to fire a Sell Market Order whenever the close price at 01-hour time frame crosses the upper Bollinger Band at 04-hours timeframe (previous close above and current close below) while the lower Keltner channel at 04-hours is above the 04-hours lower Bollinger band: the price is in an upward trend and actual volatility pushes the price to the lowest occurrence probability where we expect the trend to reverse.

An intermediate profitable situation is actually expected whenever a trade is opened during a low volatility event: the Bollinger Bands are included inside the Keltner channels. A Sell Market Order will then be fired whenever the 04-hours Bollinger bands are included in the 04-hours Keltner channels if the 01-hour candle closing price down-crosses the upper 04-hours Bollinger band.

This situation should lead to significantly lower profits than the 1st one, but will prevent to keep an open position for too long in a ranging market.

BTC/USDT 01-hours candles with examples of trades ; Bollinger bands are plotted in blue solid lines and Keltner channels in purple solid lines
BTC/USDT 01-hours candles with examples of trades when Bollinger bands are included in Keltner channels

Non-Profitable Outcomes Management

There are multiple situations where the trades could turn bad. As a matter of fact, even if the self-cointegration will offer the best probabilities of profitable trades, this is surely not a fail safe strategy: the dynamic of the cointegration indicator in this use-case is driven by 2 moving averages of the periodic return and we know for sure moving averages based strategies are barely profitable.

Two situations are designed to manage the stop-loss but in a less conventional way than usually where price levels are used. The idea is to cut the trade when we have a good level of trust it has turned badly. As per the profitable outcomes management we use volatility bounded events with position of the price in Bollinger Bands and/or Keltner channels.

The first situation has 3 conditions. A downtrend is spotted when lower Keltner channel is below the lower Bollinger band, with the price closing under the lower Bollinger band at a level significantly under the actual rate of the buy market order that opened the position. The conditions are: lower Keltner channel at 04-hours below the lower Bollinger band on the same timeframe; 01-hour candle closes below the lower Bollinger band; current candle closes 5% under the actual rate of the Buy limit order at open position.

The second condition is a detection of a sudden but durable and strong downtrend reversal. It might be the price does not reach the loss level of the 1st condition while priming a major move. This can be spotted while the lower Keltner channel is lower than the lower Bollinger band and the candle closing below the Keltner channel. This is translated as: 04-hours lower Keltner channel lower than the 04-hours lower Bollinger band; 01-hour candle closes below the 04-hours lower Keltner channel.

BTC/USDT 01-hs candles with example of a trade cut while the price closed below the lower Keltner channel
BTC/USDT 01-hs candles with example of a trade cut while the price closed 5% the actual rate of the buy order and below the lower Bollinger band, lower Keltner channel below lower Bollinger band

Backtesting Results

The hybrid strategy has been tested over 2021 on BTC/USDT market. The result of the backtesting session shows a profitable ROI about 117% with 62 trades (42 hits and 20 fails).

Broadcasting Trading Signals

Superalgos will very soon allow signal sharing directly from the user interface. In the mean time, it offers robust functionality of information broadcasting by the use of social bots for various social media platforms like Telegram, Twitter, etc.

To broadcast trading information we have set a Telegram social bot that will send the trading signals created at the trading system.

The social bot node with the Telegram Bot

The announcement will be done at the Open and Close stage nodes with a customized announcement formula:

Announcement node at the Close stage node with an example of Annoucement Formula

Signals will be broadcasted on a dedicated Telegram public channel :

https://t.me/superalgos_tradingBOT_BTC_USDT

Conclusion

We have demonstrated a profitable strategy for BTC/USDT using an original combination of indicators and by decoupling the type of conditions to open and close a position. This strategy will be used to broadcast trading signals from Superalgos trading bot, with a Telegram Bot on a public channel: https://t.me/superalgos_tradingBOT_BTC_USDT.

Feel free to share the address of the Telegram Bot!

The strategy is available asa plugin Trading System and integrated inside a plugin workspace at Superalgos for demo and education purpose.

All the material presented here can be reused and integrated freely on the condition linking to this article and the Superalgos website.

Disclaimer: The content of this article is for educational purpose only and does not constitute financial advice. Trading is not suitable for everybody; seek professional advice. Use this article at your own risk. The signal provided does not constitute a guarantee of a profitable trade and is not broadcasted by a financial professional

If you enjoyed this article and want to participate in the most promising open-source social trading platform… come and join us !

--

--

Thomas Huault
Superalgos | Algorithmic Trading

Seasoned project Manager and data scientist with a strong background in physics, I lead the Data Mining initiative of the social trading Platform Superalgos.