Among the strategies that run in the real world, the trend strategy is definitely a topic that you can’t get around and can’t hide from.
Advantages of Trend Strategy:
- Capture market trends with large profit margins
Trend strategy emphasizes on acting with the price trend, which can capture the excess profit in the larger market. This allows you to capture excess profits in larger markets. This is a much more profitable strategy than other contrarian strategies. - Reduce the frequency of trading, reduce transaction costs
Trend strategy tends to hold positions for a long time, reducing the frequency of transactions, you can effectively reduce the transaction costs, such as buying and selling fees. - Realize long-term positions, time interest earnings
Trend strategy can realize a longer time to hold positions, the accumulation of time value and interest income. - Realize the strategy and time on the double diversification
Can design a variety of trend strategy combination, while adjusting the position time, to realize the strategy and time on the double diversification. - Quantitative design and backtesting
The rules of trend strategies are relatively clear and can be quantitatively expressed and backtested, which is convenient for computerized execution. - Can be used in combination with other strategies
Trend strategy can be used in combination with reversal, arbitrage and other strategies to realize the diversity of strategies.
Overall, to capture the market trend is one of the important ways of quantitative trading, trend strategy can play its advantages in profitability and risk control.
Trend Strategy Source Code
The following is the source code of a binance exchange trend strategy, when I was a beginner, spent 300 high price to buy the code, now it seems so simple, there are many shortcomings in this code, such as the direct use of the dead loop simple and brutal, the acquisition of all the information is synchronous rather than asynchronous acquisition, not to do fault-tolerant processing, etc., but still accomplished a Quantitative trading strategy basic functions, and the author’s own backtesting data show that in the case of the right trading varieties and trading parameters in 2019 to 2020 in a year’s time to achieve an amazing 16 times the return of the results!
1 |
|
Directions for improvement
- Parameter optimization
We can test different combinations of parameters, such as the period parameter of moving averages, to find the optimal parameter to improve the yield of the strategy. 2. - use try… except statement to improve fault tolerance and make the program more robust. 3. change synchronous to asynchronous to get the relevant data.
- change synchronous to asynchronous to get the relevant data to speed up the code running speed.
- Abandon the print statement and change it to logger method, which is convenient for tracing back and tracking problems. Help to improve the program
- change all position transactions to limit the number of transactions, to facilitate the later standardization and uniformity.
- change the market price unit limit order, the transaction cost is more reasonable and controllable.
Summary
The Trend Strategy is simple and suitable for beginners, and is ideal for newcomers to quantitative trading. As the first strategy to start quantitative trading, it is essential to get a sense of accomplishment and determination to go down the road of quantitative trading. If you get started and choose a high technical difficulty strategy, perhaps less than half of the writing people collapse. Resulting in a loss of confidence.
Therefore, I very much recommend that the newcomers who have just started to run up and try, to verify their own ideas and get your first gain!