Quickly build a quantitative trading strategy

Looking carefully at the Bollinger Bands in the trend forecast, it seems that there may be a trend if the Bollinger Bands are broken, or as long as there is a trend, the Bollinger Bands will be broken. Even if the trend is not formed after the breakthrough, the stop loss is not too large in this case. Can we try to make a quantitative strategy, which is the Bollinger Bands breakthrough strategy? The answer is yes. Because the calculation of the Bollinger Bands has used the moving average, it also contains the current trend information of the market. At the same time, if the current price can break through the upper and lower rails, the momentum will generally increase unless there are special circumstances. In order to simplify our strategy, we will ignore MACD. In the end, we formed a simple Bollinger Bands breakthrough strategy, which is to break through the upper rail and go long, and break through the lower rail and go short.



1-hour K-line BB720 channel breakthrough strategy yield test


The test results show that from June 1, 2020 to June 7, 2024, the strategy has a return of 1538.12%, a winning rate of 62.5%, and a maximum cumulative loss of 29.06%, which is still a very good performance. From the figure, we can also see that the net value of the strategy is significantly higher than holding positions, especially in the bear market when Bitcoin assets fall, there can still be a large return. You can try it yourself and the statistics should be the same.


Although this strategy is effective, there is still a lot of room for optimization.


First of all, the market is not only long and short, but more of an oscillating market. The current strategy only captures the trend, without considering the conversion between trends and oscillating markets and how to make profits in oscillating markets. The idea of ​​optimization is to find an opportunity to close the position early after earning trend profits, and then make a grid-like high-sell-low-buy oscillating order in a small space.


Secondly, the strategy is not very stable if the number of orders is too small. Our intuitive feeling is that Bitcoin has about 5 good long and short markets a year, and the Bollinger Band breakthrough strategy has indeed captured 24 orders in 4 years. If you can participate in the oscillating market transactions, the profit stability of the strategy will also be improved.


Finally, the construction of the Bollinger Band channel is based on the standard deviation between the current price and the average price. This algorithm will cause the current price to have a great impact on the channel, often quickly enlarging or shrinking the channel, while the actual market changes are not so fast. We need to use other algorithms to build a channel with a slightly smaller rate of change.


Finally, we optimized the above points, built a channel with a small rate of change, and added the processing logic of the oscillating market to increase the profit to 2741.9%, increase the number of transactions to 303, and improve the stability of profit.


Optimized trend breakthrough and oscillation grid combination strategy


After we have a deep understanding of the market, we can quickly build our own trading system regardless of the technical route or indicator. A journey of a hundred miles begins with a single step. If you want to increase the profit of the strategy, you need to work twice as hard. You can add better stop-profit and stop-loss strategies and position management strategies to make the profit curve smoother. If it is manual execution, the last thing to overcome is the mentality, believe in your own strategy and strictly implement it. Even if you need to adjust it, you should optimize your trading system instead of temporarily changing the transaction when placing an order. This is what traders often say: plan your transaction and trade your plan.

Correctly use technical indicators to predict trends and enter at the right time