Bitcoin 5A Strategy@Lilibtc

Updated
In our long-term strategy, we have deeply explored the key factors influencing the price of Bitcoin. By precisely calculating the correlation between these factors and the price of Bitcoin, we found that they are closely linked to the value of Bitcoin. To more effectively predict the fair price of Bitcoin, we have built a predictive model and adjusted our investment strategy accordingly based on this model. In practice, the prediction results of this model correspond quite high with actual values, fully demonstrating its reliability in predicting price fluctuations.

When the future is uncertain and the outlook is unclear, people often choose to hold back and avoid risks, or even abandon their original plans. However, the prediction of Bitcoin is full of challenges, but we have taken the first step in exploring.

Usage Guide
Step 1: Identify the factors that have the greatest impact on Bitcoin price
Step 2: Build a Bitcoin price prediction model
Step 3: Find indicators for warning of bear market bottoms and bull market tops
Step 4: Predict Bitcoin Price in 2025
Step 5: Develop a Bitcoin 5A strategy
Step 6: Verify the performance of the Bitcoin 5A strategy
Usage Restrictions

🦮Usage Guide:

1. On the main interface, modify the code, find the BTCUSD trading pair, and select the BITSTAMP exchange for trading.
2. Set the time period to the daily chart.
3. Select a logarithmic chart in the chart type to better identify price trends.
4. In the strategy settings, adjust the options according to personal needs, including language, display indicators, display strategies, display performance, display optimizations, sell alerts, buy prompts, opening days, backtesting start year, backtesting start month, and backtesting start date.

🏃Step 1: Identify the factors that have the greatest impact on Bitcoin price

📖Correlation Coefficient: A mathematical concept for measuring influence

In order to predict the price trend of Bitcoin, we need to delve into the factors that have the greatest impact on its price. These factors or variables can be expressed in mathematical or statistical correlation coefficients. The correlation coefficient is an indicator of the degree of association between two variables, ranging from -1 to 1. A value of 1 indicates a perfect positive correlation, while a value of -1 indicates a perfect negative correlation.

For example, if the price of corn rises, the price of live pigs usually rises accordingly, because corn is the main feed source for pig breeding. In this case, the correlation coefficient between corn and live pig prices is approximately 0.3. This means that corn is a factor affecting the price of live pigs. On the other hand, if a shooter's performance improves while another shooter's performance deteriorates due to increased psychological pressure, we can say that the former is a factor affecting the latter's performance.

Therefore, in order to identify the factors that have the greatest impact on the price of Bitcoin, we need to find the factors with the highest correlation coefficients with the price of Bitcoin. If, through the analysis of the correlation between the price of Bitcoin and the data on the chain, we find that a certain data factor on the chain has the highest correlation coefficient with the price of Bitcoin, then this data factor on the chain can be identified as the factor that has the greatest impact on the price of Bitcoin. Through calculation, we found that the 🔵number of Bitcoin blocks is one of the factors that has the greatest impact on the price of Bitcoin. From historical data, it can be clearly seen that the growth rate of the 🔵number of Bitcoin blocks is basically consistent with the movement direction of the price of Bitcoin. By analyzing the past ten years of data, we obtained a daily correlation coefficient of 0.93 between the number of Bitcoin blocks and the price of Bitcoin.

🏃Step 2: Build a Bitcoin price prediction model

📖Predictive Model: What formula is used to predict the price of Bitcoin?

Among various prediction models, the linear function is the preferred model due to its high accuracy. Take the standard weight as an example, its linear function graph is a straight line, which is why we choose the linear function model. However, the growth rate of the price of Bitcoin and the number of blocks is extremely fast, which does not conform to the characteristics of the linear function. Therefore, in order to make them more in line with the characteristics of the linear function, we first take the logarithm of both. By observing the logarithmic graph of the price of Bitcoin and the number of blocks, we can find that after the logarithm transformation, the two are more in line with the characteristics of the linear function. Based on this feature, we choose the linear regression model to establish the prediction model.
From the graph below, we can see that the actual red and green K-line fluctuates around the predicted blue and 🟢green line. These predicted values are based on fundamental factors of Bitcoin, which support its value and reflect its reasonable value. This picture is consistent with the theory proposed by Marx in "Das Kapital" that "prices fluctuate around values."

The predicted logarithm of the market cap of Bitcoin is calculated through the model. The specific calculation formula of the Bitcoin price prediction value is as follows:
```btc_predicted_marketcap = math.exp(btc_predicted_marketcap_log)
btc_predicted_price = btc_predicted_marketcap / btc_supply```
🏃Step 3: Find indicators for early warning of bear market bottoms and bull market tops

📖Warning Indicator: How to Determine Whether the Bitcoin Price has Reached the Bear Market Bottom or the Bull Market Top?

By observing the Bitcoin price logarithmic prediction chart mentioned above, we notice that the actual price often falls below the predicted value at the bottom of a bear market; during the peak of a bull market, the actual price exceeds the predicted price. This pattern indicates that the deviation between the actual price and the predicted price can serve as an early warning signal. When the 🔴 Bitcoin price deviation is very low, as shown by the chart with 🟩green background, it usually means that we are at the bottom of the bear market; Conversely, when the 🔴 Bitcoin price deviation is very high, the chart with a 🟥red background indicates that we are at the peak of the bull market.

This pattern has been validated through six bull and bear markets, and the deviation value indeed serves as an early warning signal, which can be used as an important reference for us to judge market trends.

🏃Step 4:Predict Bitcoin Price in 2025

📖Price Upper Limit

According to the data calculated on February 25, 2024, the 🟠upper limit of the Bitcoin price is \$194,287, which is the price ceiling of this bull market. The peak of the last bull market was on November 9, 2021, at \$68,664. The bull-bear market cycle is 4 years, so the highest point of this bull market is expected in 2025. That is where you should sell the Bitcoin. and the upper limit of the Bitcoin price will exceed \$190,000. The closing price of Bitcoin on February 25, 2024, was \$51,729, with an expected increase of 2.7 times.

🏃Step 5: Bitcoin 5A Strategy Formulation

📖Strategy: When to buy or sell, and how many to choose?

We introduce the Bitcoin 5A strategy. This strategy requires us to generate trading signals based on the critical values of the warning indicators, simulate the trades, and collect performance data for evaluation. In the Bitcoin 5A strategy, there are three key parameters: buying warning indicator, batch trading days, and selling warning indicator. Batch trading days are set to ensure that we can make purchases in batches after the trading signal is sent, thus buying at a lower price, selling at a higher price, and reducing the trading impact cost.
In order to find the optimal warning indicator critical value and batch trading days, we need to adjust these parameters repeatedly and perform backtesting. Backtesting is a method established by observing historical data, which can help us better understand market trends and trading opportunities.

Specifically, we can find the key trading points by watching the Bitcoin price log and the Bitcoin price deviation chart. For example, on August 25, 2015, the 🔴 Bitcoin price deviation was at its lowest value of -1.11; on December 17, 2017, the 🔴 Bitcoin price deviation was at its highest value at the time, 1.69; on March 16, 2020, the 🔴 Bitcoin price deviation was at its lowest value at the time, -0.91; on March 13, 2021, the 🔴 Bitcoin price deviation was at its highest value at the time, 1.1; on December 31, 2022, the 🔴 Bitcoin price deviation was at its lowest value at the time, -1.

To ensure that all five key trading points generate trading signals, we set the warning indicator Bitcoin price deviation to the larger of the three lowest values, -0.9, and the smallest of the two highest values, 1. Then, we buy when the warning indicator Bitcoin price deviation is below -0.9, and sell when it is above 1.

In addition, we set the batch trading days as 25 days to implement a strategy that averages purchases and sales. Within these 25 days, we will invest all funds into the market evenly, buying once a day. At the same time, we also sell positions at the same pace, selling once a day.

Adjusting the threshold is an indispensable step for better performance. Here are some suggestions for adjusting the batch trading days and critical values of warning indicators:

• Batch trading days: Try different days like 25 to see how it affects overall performance.
• Buy and sell critical values for warning indicators: iteratively fine-tune the buy threshold value of -0.9 and the sell threshold value of 1 exhaustively to find the best combination of threshold values.

Through such careful adjustments, we may find an optimized approach with a lower maximum drawdown rate (e.g., 11%) and a higher cumulative return rate for closed trades (e.g., 474 times). The chart below is a backtest optimization chart for the Bitcoin 5A strategy, providing an intuitive display of strategy adjustments and optimizations.

In this way, we can better grasp market trends and trading opportunities, thereby achieving a more robust and efficient trading strategy.

🏃Step 6: Validating the performance of the Bitcoin 5A Strategy

📖Model interpretability validation: How to explain the Bitcoin price model?

The interpretability of the model is represented by the coefficient of determination R squared, which reflects the degree of match between the predicted value and the actual value. I divided all the historical data from August 18, 2015 into two groups, and used the data from August 18, 2011 to August 18, 2015 as training data to generate the model. The calculation result shows that the coefficient of determination R squared during the 2011-2015 training period is as high as 0.81, which shows that the interpretability of this model is quite high. From the Bitcoin price logarithmic prediction chart in the figure below, we can see that the deviation between the predicted value and the actual value is not far, which means that most of the predicted values can explain the actual value well.

The calculation formula for the coefficient of determination R squared is as follows:
```residual = btc_close_log - btc_predicted_price_log
residual_square = residual * residual
train_residual_square_sum = math.sum(residual_square, train_days)
train_mse = train_residual_square_sum / train_days
train_r2 = 1 - train_mse / ta.variance(btc_close_log, train_days)```
📖Model stability verification: How to affirm the stability of the Bitcoin price model when new data is available?

Model stability is achieved through model verification. I set the last day of the training period to February 2, 2024 as the "verification group" and used it as verification data to verify the stability of the model. This means that after generating the model if there is new data, I will use these new data together with the model for prediction, and then evaluate the interpretability of the model. If the coefficient of determination when using verification data is close to the previous training one and both remain at a high level, then we can consider this model as stability. The coefficient of determination calculated from the validation period data and model prediction results is as high as 0.83, which is close to the previous 0.81, further proving the stability of this model.

📖Performance evaluation: How to accurately evaluate historical backtesting results?

After detailed strategy testing, to ensure the accuracy and reliability of the results, we need to carry out a detailed performance evaluation on the backtest results. The key evaluation indices include:

• Net value curve: As shown in the rose line, it intuitively reflects the growth of the account net value. By observing the net value curve, we can understand the overall performance and profitability of the strategy.

The basic attributes of this strategy are as follows:
Trading range: 2015-8-19 to 2024-2-18, backtest range: 2011-8-18 to 2024-2-18
Initial capital: 1000USD, order size: 1 contract, pyramid: 50 orders, commission rate: 0.2%, slippage: 20 markers.

In the strategy tester overview chart, we also obtained the following key data:
• Net profit rate of closed trades: as high as 474 times, far exceeding the benchmark, as shown in the strategy tester performance summary chart, Bitcoin buys and holds 210 times.
• Number of closed trades and winning percentage: 100 trades were all profitable, showing the stability and reliability of the strategy.
• Drawdown rate & win-loose ratio: The maximum drawdown rate is only 11%, far lower than Bitcoin's 78%. Profit factor, or win-loose ratio, reached 500, further proving the advantage of the strategy.

Through these detailed evaluations, we can see clearly the excellent balance between risk and return of the Bitcoin 5A strategy.

⚠️Usage Restrictions: Strategy Application in Specific Situations

Please note that this strategy is designed specifically for Bitcoin and should not be applied to other assets or markets without authorization. In actual operations, we should make careful decisions according to our risk tolerance and investment goals.
Release Notes:
Update the author's instruction.
Release Notes:
Update the author's instruction.

Invite-only script

Access to this script is restricted to users authorized by the author and usually requires payment. You can add it to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author. Contact lilibtc for more information, or follow the author's instructions below.

TradingView does not suggest paying for a script and using it unless you 100% trust its author and understand how the script works. In many cases you can find a good open-source alternative for free in our Community Scripts.

Disclaimer