Introduction

Leading and lagging indicators serve as crucial tools for traders seeking to manage capital in the financial markets. In this research post, we’ll review what leading indicators are, why Bitcoin’s price action can be used as a leading indicator for upcoming turbulence in the US Equity markets, and how to implement a trading strategy with the LEAN trading engine that uses this information. The results show that rotating capital between US Equities and cash based on Bitcoin’s price action increases the risk-adjusted returns of long-term Equity investors.

Background

A leading indicator is a factor that contains information that’s predictive of future events. They enable traders to anticipate changes in market dynamics, like a shift in regimes from trending to reversion,  before they happen. In contrast, a lagging indicator is a factor that contains information that can confirm changes in market dynamics. They are useful for understanding what has already happened, but they don’t predict them in advance. An example of a lagging indicator is the unemployment rate because it rises or falls after the economy has already changed direction.

Bitcoin has traditionally been seen as a risk-on asset and it trades 24 hours per day, so it can be the first thing investors sell when they are desperate for liquidity or scared of upcoming volatility. As a result, Bitcoin can act as a leading indicator for crises in other markets. For example, if there is breaking news of a new global pandemic when the US Equity markets are closed, investors may act to immediately reduce their exposure by selling their Bitcoin holdings. To capitalize on this human behavior, the trading strategy implemented in this research post allocates 100% of its portfolio to SPY, but resorts to cash when Bitcoin crashes two standard deviations below its two year moving average.

Implementation

To implement this strategy, we start by subscribing to the asset we want to trade.

self._equity = self.add_equity('SPY')

Next, we subscribe to the Bitcoin-USD trading pair.

self._btc = self.add_crypto('BTCUSD')

Now we create the Bollinger Bands indicator such that the lower band represents a two standard deviation move below Bitcoin’s average price over the last 30 days of hourly trading data.

self._btc.bb = self.bb(self._btc.symbol, 30*24, 2, resolution=Resolution.HOUR)

At the end of every hour, we want to re-evaluate our SPY position, so let’s attach an event handler to the indicator object.

self._btc.bb.updated += self._trade

The event handler simply checks if Bitcoin is trading at least two standard deviations below its average price. If it is, the algorithm liquidates its SPY position and holds USD. Otherwise, it allocates 100% to SPY.

def _trade(self, indicator, indicator_data_point):
    below_band = self._btc.price < self._btc.bb.lower_band.current.value
    if below_band and self.portfolio.invested:
        self.liquidate()
    elif not below_band and not self.portfolio.invested:
        self.set_holdings(self._equity.symbol, 1)

Conclusion

In this simple research post we explored how Bitcoin might be a leading indicator for upcoming corrections in the US Equity markets, and how to implement a trading strategy that rotates between the S&P 500 Index and cash based on statistical measures of Bitcoin’s price action. The results show that the strategy achieves a 0.622 Sharpe ratio while the S&P 500 Index achieves a 0.5 Sharpe ratio over the same time period. In conclusion, the strategy outperforms the S&P 500 Index in terms of risk-adjusted returns.

To test if the strategy's performance was reliant on the specific parameters chosen, we ran an optimization job. We varied the number of months in the lookback window of the Bollinger Band indicator from 6 months to 36 months in steps of 6. We also varied the number of standard deviations between the middle band and the lower band from 1 to 3 in steps of 0.5. About 77% (23/30) of the parameter combinations outperformed the benchmark, suggesting the strategy is not overfit.

We tested this strategy with other Cryptocurrencies, including ETH, XRP, and DOGE. However, they all performed worse compared to using BTC. We concluded that the other Cryptocurrencies are more volatile than BTC, so they trip below the lower Bollinger Band more frequently, which means they spend less time in SPY overall. Essentially, their extreme movements can be seen as noise, whereas BTC can be seen as the signal.