Derek Melchin
|
Bitcoin Trend Scanning ML Trading StrategyTrend Scanning is a technique introduced by Marcos López de Prado that uses machine learning to quantify the market regime. In an algorithm that I created to promote the new integration of mlfinlab on QuantConnect, I use mlfinlab's Trend Scanning implementation to trade the Bitcoin-USD pair. How the Strategy WorksTo determine if the Bitcoin is in an uptrend, the algorithm provides the trailing 3 months of closing prices to the Trend Scanning function. With the settings I provide, the function returns a 1 (uptrend), 0 (no trend), or -1 (downtrend) to represent the current market trend. When it determines Bitcoin is in an uptrend, the algorithm allocates 100% of the portfolio to Bitcoin. Otherwise, it just holds US Dollars. Strategy ResultsIf we backtest the trading strategy from January 1, 2016 to October 14, 2022, the algorithm achieves a ~1.8 Sharpe ratio. In contrast, buy-and-hold with Bitcoin achieves a 1.2 Sharpe ratio over the same time period. Therefore, the strategy outperforms buy-and-hold for risk-adjusted returns. Sensitivity AnalysisIn cases like this, the 3 month lookback window could have been a lucky number. To test the sensitivity of this parameter, we can adjust the lookback window length and see how it impacts the strategy performance. In this case, the strategy continues to outperform when we adjust the parameter value. In fact, any lookback window between 1 month and 12 months led the algorithm to achieving higher risk-adjusted returns than just the buy-and-hold strategy, suggesting Trend Scanning can robustly detect alpha. Strategy CodeLearn MoreTo learn more about using mlfinlab on QuantConnect, checkout the QC docs. To learn more about Trend Scanning, see Machine Learning for Asset Managers (López de Prado, 2020). |