A complete quantitative trading life cycle is more than just the trading strategy itself. It consists of at least six parts, including: strategy design, model building, backtesting tuning, simulation trading, real market trading, strategy monitoring, etc.
First of all, to do quantitative trading must first return to the trading market, to observe the price in the market, understand the law of market volatility, and try to infer each trading logic, and finally summarize the trading strategy. There are no shortcuts here, you may need to read classic investment books, or continue to insist on trading, summing up experience in failure.
For beginners of quantitative trading, the best way to start trading strategies is to imitate. Directly use the off-the-shelf technical analysis indicators to build the strategy logic and write the rules of trading, so that you can get a simple strategy. For example: If the price is higher than the average price of the last 10 days, buy long. If the price is lower than the average price of the last 10 days, sell short. Its architecture is like this (as shown below):
Of course, with the accumulation of strategic experience, after the formation of your own trading methods, the choice of logic will be more and more diversified, and then advanced to more systematic quantitative methods. If you can be a trader with quantitative thinking, whether in the stock or futures market, people with such ability will have a stable profitability regardless of which trading market.
Second, you need to master a quantitative trading tool to write trading strategies and implement your trading ideas. Commonly used software on the market is fine. But if you want to be a high-end quantitative trader, you need to learn a computer programming language. It is recommended to use Python, because it is the authoritative language of scientific computing, and provides a variety of open source analysis packages, file processing, network, Database, etc.
If your programming ability is weak, I believe this is the weakness of most beginners. It is recommended to use a relatively simple visual programming language or the M language, which can improve the interest of learning quantitative trading, and let you focus on strategy and complete strategy efficiently. As shown below: Using the M language, develop a trading strategy as described above.
The strategy code in the above figure is a M language demonstration using the FMZ Quant tool. It integrates many function modules that can be used directly, and supports backtesting and real-time trading functions. It is a good quick start method.
Backtesting and tuning
Then, when the strategy model is written, the next step is to backtest the strategy and filter and optimize the parameters. The strategy can be backtested with different parameters, and the Sharpe ratio, maximum retracement, and annualized income of the strategy can be observed. Through continuous debugging and modification of the strategy, a perfect quantitative trading strategy is finally obtained.
For example, we use 2017 historical data as sample data and 2018 historical data as off-sample data. First use the 2017 data to optimize several sets of well-behaved parameters, and then use these parameters to backtest the data in 2018. Under normal circumstances, the backtest results outside the sample are not as good as the backtest results in the sample. However, if the sample is very different from the results in the sample, then this strategy is almost ineffective. It is necessary to observe and analyze the reason for the strategy failure.
Assume that the strategy failure is due to off-sample data, a large loss caused by a few extreme market price movement, then you can add a fixed stop loss condition to avoid this risk; if the strategy is found to be invalid due to too many transactions, then we can Tightening the trading logic a bit and reducing the frequency of trading.
It should be noted that if the trading logic itself is wrong at the beginning, it is difficult to get a profitable strategy no matter how you modify it. At this time, you need to re-examine your own strategic thinking. In addition, in the parameter optimization, the more parameter groups available, the better, indicating that the applicability of the strategy is extensive. In the backtest, the strategy of too few transactions may be a survivor bias. If the result of the backtest is a super-profit curve, in many cases your logic is wrong.
Next, when you get a strategy that makes the trading logic correct and makes money both inside and outside the sample, don't rush to trade on the real account. Especially for beginners, you must first run the simulation account for at least 3 months. If it is a mid-low frequency overnight strategy, you need even longer simulation trading time.
In a completely unknown simulation market in the future, the observation of strategy will behave in the simulation environment, and carefully check whether the backtest signal is consistent with the simulated trading signal, and whether the price at the time of placing the order is different from the price at the time of the transaction, if the performance is in line with the expectation, then the strategy is effective.
Real Market Trading
Finally, after a long period of time to test the strategy, you can put the strategy into actual combat and trade. Of course, we must always be vigilant in the process of quantitative trading to guard against extreme market conditions. In the real market, the expectations of the strategy are generally discounted, and the expected 50% is qualified.
Strategy Running Monitoring
Finally, we need to remind everyone that with the trading running, we must also observe the effectiveness of the strategy. When we find that the strategy exceeds the expected loss, we must re-evaluate the strategy. Because market characteristics are subject to change, our current strategy is primarily aimed at past market characteristics. Once the market characteristics change, the strategy model should be adjusted in time, or the strategy should be temporarily suspended.
To sum up
In this article we describe the complete process of quantitative trading. All in all, if you are an investor with market experience, what will block you will be the computer programming language foundation, you can start with the visual programming language or the M language, exercise yourself on this platform, build a strategy, and then gradually turn to Python high-end quantitative trading.
If you are a science and engineering student or IT practitioner with strong programming skills, it will be market investment experience to block you, and don't underestimate this. As a qualified quantitative investor, two types of knowledge are indispensable.
Next section notice
The core of the entire quantitative trading life cycle is the trading strategy. In the next section, we will elaborate on the elements of a complete trading strategy from the perspective of trading strategy structure. This will help you build your trading strategy more comprehensively and take the quantitative trading to a new level!
Try to write the trading strategy in this section by M language.
What is the most important performance indicator in the quantitative trade backtest?