“Unlocking the Potential of Bitcoin Cycles: A Data Science and Machine Learning Approach”

Bitmus
Coinmonks
Published in
14 min readJul 12, 2023

--

Since my first encounter with Bitcoin back in 2013, its roller-coaster journey has left me captivated. I vividly remember the exhilaration of witnessing the price surge from $15 to $1,133 in just months, only to be followed by a gut-wrenching 81% plummet throughout 2014 and 2015. At the moment I was just a student and lived the price movements from the sidelines. Then, in December 2017, Bitcoin once again seized the headlines, prompting me to invest for the first time at $11,000, only to witness it soar to $19,000 within a fortnight. However, my joy was short-lived as the subsequent year saw an 83% decline, ultimately leading to my own selling at a loss. It became clear to me that a pattern was at play, yet my knowledge of technology fundamentals and market dynamics was severely lacking. I had unwittingly engaged in speculative investing fueled by media hype — a gamble I had grown weary of.

Fast forward to 2020, amidst the turmoil of a pandemic-induced economic crisis, I found myself with ample time to embark on a journey of understanding and exploration. Through exhaustive research via articles, podcasts, and YouTube videos, I rediscovered Bitcoin, this time recognizing its potential as a hedge against impending inflation. Equipped with newfound knowledge, coupled with my growing expertise in data science, I resolved to develop an investment strategy grounded in objective analysis rather than the whims of media sensationalism. And thus, the genesis of my own machine learning strategy for investing in Bitcoin began.

Having experienced three bull markets and three bear markets, each time culminating in higher prices, I yearned to uncover the driving force behind these cyclical fluctuations. Shunning the noise of media narratives and macroeconomic variables, I delved into the essence of valuation — scarcity. My research led me to the concept of Bitcoin halving, a phenomenon that occurs approximately every four years, wherein the reward for Bitcoin miners is halved every 210,000 blocks.

As demand for Bitcoin remains constant or grows, the diminishing supply triggers a market re-balancing and, subsequently, a new valuation or price level of an “updated” asset class. This re-balancing is somehow congruent with the changes of narratives or phases proposed in the Bitcoin Stock-to-Flow Cross Asset Model.

These Bitcoin narratives seem very continuous in the chart. However, if we combine the narratives with financial milestones … they look very much like phases with more abrupt transitions:

1. “Proof of concept” -> after Bitcoin white paper [3]

2. “Payments” -> after USD parity (1BTC = $1)

3. “E-Gold” -> after 1st halving, almost gold parity (1BTC = 1 ounce of gold)

4. “Financial asset” -> after 2nd halving ($1B transactions per day milestone, legal clarity in Japan and Australia, futures markets at CME and Bakkt)

The post-halving period typically witnesses a surge in price, often exacerbated by media hype surrounding this performing asset, and is known as the illustrious “bull run.” However, as profits are inevitably taken, the price eventually retreats, marking the onset of the “bear market,” which eventually settles at a new equilibrium and a higher price level than the previous cycle.

Bitcoin halving simplified dynamics. Source: One in a Species

Given that this fundamental dynamic is ingrained within Bitcoin’s code, our aim is to identify patterns within previous cycles, empowering us to navigate a new cycle based on these underlying assumptions. Instead of attempting to predict specific prices, our focus lies in classifying each cycle as either a bull or bear trend. By leveraging the power of data science and machine learning, we seek to unravel the patterns held within Bitcoin’s historical cycles, unlocking insights that can guide our investment decisions with a greater degree of certainty.

BTC/USD daily chart colored with time to next halving. Source: Bitcointrends

Join me on this captivating journey as we explore the fascinating world of Bitcoin cycles, employing cutting-edge techniques to analyze and interpret data condensed in a Bitcointrends live app. Together, let’s embark on a quest to harness the power of technology, transforming speculation into strategy, and making informed choices that have the potential to shape our financial futures.

Methodology

To comprehend the intricacies of Bitcoin cycles, it is crucial to identify the most effective metrics for understanding and describing them. Intuitively, oscillators that exhibit repetitive patterns within a similar time frame of the cycle hold promise in capturing its essence. Traditional market approaches typically rely on fundamental and technical metrics. While fundamental analysis seeks to determine an investment’s intrinsic value based on financial conditions and prevailing market and economic factors, it may fall short in capturing the variations inherent in these cycles. This is primarily because, apart from changes in miners’ rewards and an expanding customer adoption base, Bitcoin’s fundamentals remain relatively consistent across cycles. Consequently, fundamental analysis tends to suggest a monotonically increasing function rather than the cyclic bull-bear trends observed in each period.

On the other hand, technical analysis focuses on aggregated price and trading volume patterns within historical data. However, it may overlook crucial fundamental movements occurring within the Bitcoin network. Leveraging Bitcoin’s blockchain technology, which operates as a transparent ledger, we can employ on-chain analysis to access blockchain data and delve into individual transaction volumes, network activity, and address behaviors. This approach enables us to gain real-time insights into the distribution of Bitcoin, thereby fostering a deeper understanding of supply and demand dynamics, fund movements, and the overall network health.

Furthermore, Bitcoin and cryptocurrencies are highly speculative assets, whose bull and bear trends are profoundly influenced by collective emotions surrounding the adoption of this technology. By utilizing sentiment analysis, we can examine social media discussions, assess news sentiment, and analyze market sentiment indicators. This comprehensive assessment helps capture the collective emotions, opinions, and beliefs of market participants. In turn, it facilitates a better understanding of market sentiment and investor psychology, both of which significantly impact price movements. Sentiment analysis provides valuable insights into market trends, shifts in sentiment, and potential market manipulation, offering a more holistic perspective.

By integrating technical, on-chain, and sentiment analysis, we propose a multidimensional approach that considers historical data, real-time network dynamics, and market sentiment. Building upon this idea, we have conducted an analysis of nine metrics encompassing technical, on-chain, and sentiment indicators that demonstrate an oscillating behavior within the Bitcoin cycle. Through the incorporation of information from multiple sources, this data-driven methodology aims to identify recurring patterns and map the conditions regarding the cycle’s trend.

By adopting this multidimensional approach, we strive to unravel the complexities of Bitcoin cycles, empowering investors with a more comprehensive understanding of the market indicators.

Indicator Selection

The selected metrics encompass a range of oscillating indicators that provide valuable insights into Bitcoin cycles. They include two technical indicators derived solely from price movements, five on-chain indicators based on wallet movements within the blockchain, and two sentiment indicators utilizing information extracted from social media platforms. Each indicator exhibits distinct cyclic or semi-cyclic peaks, valleys, and mid-cycle areas, allowing for individual analysis of market trends. Notably, our analysis has identified euphoric peak periods represented by the top red regions, fearful bottom regions depicted in green, and transitional regions in between (https://bitcointrends.app/). While this region analysis serves as an initial step in evaluating individual metrics, it is crucial to implement a confluence approach to mitigate risks and accurately classify the market trend.

Snapshot (05–07–2023) of indicators region analysis. Source: Bitcointrends

1. Technical Indicators:

  • Time Channel: Utilizes a logarithmic growth curve estimation of Bitcoin to estimate the historic growth trend of Bitcoin with time. This curve can be taken as the general trend line of Bitcoin throughout its history. Furthermore, the normalized deviation of the price from this curve can be taken as an oscillator similar to the Bitcoin Rainbow Price Chart Indicator whose idea dates back to a Bitcoin forum in 2014.
BTC/USD daily chart colored with Time channel. Source: Bitcointrends
BTC/USD daily chart colored with Moving Average Log ratio. Source: Bitcointrends

2. On-chain Indicators:

  • NUPL (Net Unrealized Profit/Loss): Measures the difference between Unrealized Profit and Unrealized Loss to determine whether the network as a whole is currently in a state of profit or loss.
BTC/USD daily chart colored with NUPL. Source: Bitcointrends
  • MVRV-Z Score: Compares market value and realized value to assess when an asset is overvalued or undervalued.
BTC/USD daily chart colored with MVRV-Z. Source: Bitcointrends
  • Puell Multiple: This metric looks at the supply side of Bitcoin’s economy, specifically bitcoin miners and their revenue. It explores market cycles from a mining revenue perspective.
BTC/USD daily chart colored with Puell Multiple. Source: Bitcointrends
  • Thermocap Ratio: The Market Cap to Thermocap Ratio is simply defined as Market cap / Thermocap and can be used to assess if the asset’s price is currently trading at a premium with respect to total security spend by miners.
BTC/USD daily chart colored with Thermocap Ratio. Source: Bitcointrends
  • Supply in Profit: Represents the absolute amount of coins in a given network that are currently in profit. It is calculated by determining which coins were last moved when the price was lower than the current price.
BTC/USD daily chart colored with Supply in profit. Source: Bitcointrends

3. Sentiment Indicators:

  • Fear and Greed Index: A metric that analyzes emotions and sentiments around Bitcoin from different sources and compiles them into one simple number. It ranges from a value of 0 (extreme fear) to a value of 100 (extreme greed). [Fear and Greed Index]
BTC/USD daily chart colored with Fear and Greed Index. Source: Bitcointrends
  • Fear and Greed Moving Average : Uses the 90-day simple moving average of the Fear and Greed Index to smooth out noise and capture the overall trend.
BTC/USD daily chart colored with Fear and Greed Index Moving Average. Source: Bitcointrends

These individual metrics reveal common cyclic peaks, valleys, and mid-cycle areas. However, being biased towards any of them increases the risk of missing out relevant market trend changes. Therefore it is essential to implement a confluence approach that combines these metrics and reduces the risk when assessing the market trend. By leveraging this multidimensional analysis, we aim to provide an unbiased and data oriented understanding of the Bitcoin cycles.

Confluence risk approach

Each of these metrics exhibits an oscillation pattern that closely aligns with the Bitcoin cycle. High values are observed near the peaks, while low values occur close to the bottom of the cycle. However, assessing the overall risk based on a single metric is challenging. To address this, we employ a linear combination that averages all the metrics, creating a single value known as the “confluence risk.”

To compute the confluence risk, we first normalize each metric between 0 and 1 so all of them have a similar weight in the peaks and bottoms. We then calculate the mean value across all the metrics, producing a composite risk indicator. Notably, bottoms tend to have confluence risk values below 0.25, while peaks typically exceed 0.75 (Live confluence risk: Bitcointrends).

Confluence risk — line version. Source: Bitcointrends

By assigning a color range from green to red based on these values, it becomes evident that green areas represent low-risk periods, ideal for market entry (Live confluence risk: Bitcointrends). Conversely, red areas indicate high-risk periods, characterized by price volatility driven by FOMO, and suggest good moments for exiting the market.

Confluence risk — colored version. Source: Bitcointrends

Although the confluence approach yields reasonable results, it forces equal importance or weight for each variable in determining the final risk value. To address this limitation, we have implemented a machine learning soft vote approach which trains multiple models with historical data by finding the optimum weights to each variable that best explains it. Such an approach results in a more elegant solution that better captures the complexities of the Bitcoin market dynamics.

Machine Learning Soft Vote Approach

In addition to the confluence approach, we also employ machine learning models to identify cycle trends. Rather than forecasting price or percentage changes using a regular time series approach, we tackle a classification problem by determining whether the trend within the Bitcoin cycle is bullish or bearish.

Data Preparation

To establish the target variable, we manually classify the trends as “bear trend” from peak to bottom and “bull trend” from bottom to peak during the observed cycles. Furthermore, to avoid speculation on the current trend, which is open for debate, we limit the classification to data until July 2021. Beyond that date, some would argue Bitcoin entered into a second mini bull cycle that lasted until November 2021 and then turned into the bear market, while others would argue the bear market started after the first peak.

Target variable classification and data preparation. Source: Bitcointrends

Next, the historical data is divided into training and test datasets, with a split of 60% for training and 40% for testing. This partitioning involves selecting a specific date (2017–07–18) to separate the data based on the desired ratios. The training dataset consists of classified data preceding the chosen date, while the testing dataset encompasses all data points occurring after that date. This partitioning strategy ensures that the model is trained on past cycles and evaluated on the most recent data, enabling us to assess its predictive capabilities on “unseen” data.

Machine Learning Models

We train seven machine learning classification models (Random Forest, Decision Trees, Logistic Regression, Support Vector Machine, K-Nearest Neighbors, Naive Bayes, and Neural Networks) using the training dataset. All models employ the same set of input features, excluding the Fear and Greed index metrics due to limited availability of data before 2018. These models are trained to predict the target variable, classifying the market state as either “bear trend” or “bull trend.”

To consolidate the predictions from all models, we employ a soft vote algorithm. This algorithm considers the predictions made by each model over a rolling window of the past 7 days. Consequently, the final classification of a trend as either bullish or bearish is determined by the majority of votes from the models during the previous week. To ensure a more confident consensus, we implement a minimum voting majority threshold of 85%. Any voting consensus below this threshold is considered as a middle uncertain trend.

Soft voting algorithm for classification.

Individual Model Accuracy Assessment

After training the models, we estimate their individual classification accuracy using the testing data. This assessment helps identify the models that are most effective in predicting the Bitcoin cycle trend. As shown in the Individual model testing accuracy Table below, Naive Bayes performs the worst with an accuracy of 74.73%, while the remaining models achieve accuracy rates above 90%. Notably, Support Vector Machines exhibit the highest accuracy at 97.4%.

Individual model testing accuracy

Examining the classification results for Support Vector Machines in the graph below, we observe that the training data covers the period from July 2011 to July 2017, just a few months before the 2017 peak. The testing data accurately identifies the trend reversal of the 2017 December peak with a mismatch of only 4 days, as well as the December 2018 bottom. Additionally, it is worth highlighting that the model does not indicate a trend reversal during the COVID-19 crash. This indicates that, from a data perspective, this event is an anomaly outside of the regular cycle trends and should be classified as a black swan event as many experts have done so.

Support Vector Machine bull/bear classification. Source: Bitcointrends

Soft Voting Results

The results obtained from this methodology demonstrate a remarkable accuracy rate of over 95% on unseen data, as depicted in the soft vote Figure below. It is worth noting that the 98.5% accuracy is achieved by excluding the votes from the two worst performers, namely Naive Bayes and Decision Trees. Furthermore, this methodology accurately identified the trend change from bullish to bearish in December 2017, and again from bearish to bullish in December 2018. Similarly, it correctly predicted the transition from bullish to bearish in April 2021, near Bitcoin’s price peak, and defined a bear market that only reverted to bullish in June 2022. By adjusting the majority threshold, the algorithm would classify or not a second mini bull market in November 2021, which would resulted in Bitcoin’s double peak.

As of June 2022, all voters with a 100% majority have classified the current market as bullish, with the bottom most probably having occurred in December 2022. From a data perspective, the current market conditions could be classified as the beginning of the bull market, making it the best time to accumulate give the confluence risk is still low.

Soft vote classification using Random Forest, Logistic Regression, Support Vector Machine, K-Nearest Neighbors, and Neural Networks over a 7 day rolling window. Source: Bitcointrends

Conclusion

By leveraging the Bitcoin halving as a foundation, our data-driven approach utilizes nine selected metrics, including technical, on-chain, and sentiment indicators, to assess risk within the current market cycles. The machine learning component classifies the trend as either bear or bull, rather than attempting to forecast future price movements, while the confluence risk estimates how extended the bull or bear trend is. This approach focuses on features that exhibit cyclical or semi-cyclical behavior within the cycles. While past performance does not guarantee future results, historical data with different perspectives can serve as an indicator for market navigation.

This method provides a powerful tool for participants to navigate the Bitcoin market. A simple strategy could involve dollar-cost averaging positions in and out of the market based on soft vote trend changes, while utilizing the confluence risk to size positions according to individual risk tolerance. We are currently making a metric that includes all this information in a simple yet valuable form.

What is next?

Thanks for taking a look at this post. If you want to dive deeper, or want to learn more about the models, we’ve condensed them in a free interactive platform offered in bitcointrends.app where you can explore the scenarios and conditions that best fit your investing and risk profile. The app is in constant development and we are looking to include other indicators and analyses that will complement the methods above.

If you would like to exchange ideas or discuss further about Bitcoin seen through a data science perspective, add us on twitter (@BitmusAnalytics) or follow on Medium (Bitmus) where we try to post regularly.

Stay tuned, and keep accumulating!

--

--

Bitmus
Coinmonks
Writer for

Data Scientist specialized in Bitcoin analysis.