I want to build a quantitative trading system, what are the steps?

2024-06-04

Many people, after trading for three to four years, begin to consider quantifying their trading strategies. This is mainly because at this stage of trading, most indicators and trading systems have been tried, and a relatively mature trading logic has been formed. At this point, what may need to be broken through is one's own execution and mindset issues.

So many people start thinking about quantifying their trading strategies, writing them into trading programs to avoid some of our own human nature issues. I myself tried to do quantification in 2016 and wrote some trading system programs. Today, I will discuss the steps of quantifying a trading system and the potential problems that may be encountered.

Step 1: Have a mature trading system.

Manual trading and quantitative trading are essentially different in the execution process, but the most basic trading model, or trading system, is necessary. However, there is a problem here: not all manual trading systems can be programmed, because when writing the program, one will find the limitations of programming languages. Some behaviors in manual trading, such as observing charts and making judgments, are difficult for programming languages to implement, and this also depends on the level of the programmer.

Advertisement

For example, when counting waves, people can have their own judgments, identifying the low point and the second low point of the retracement, but the program cannot read these points, making it difficult to quantify such manual programs.

Therefore, to quantify a trading system, it is necessary to standardize the details of the trading system, make adjustments and modifications, and while ensuring that the programming language can implement it, it is also very challenging to maintain its profitability.

Step 2: Write the program.

Two ways: write it yourself or have a programmer write it for you.

If you write it yourself, as a trader, you are the one who understands your own trading system the best, including all the details and the difficulty of execution, you have a clear understanding. However, writing code is different from trading, and the threshold is there; it is quite challenging for a trader to learn coding on their own.

I have also had friends ask me if being a programmer myself would give me an advantage. Of course, if you can already write code, it is definitely an advantage. But currently, not many programmers can do well in trading, also because everyone faces the same human nature issues, and programmers may focus more on the implementation of the strategy, neglecting the profitability of the strategy. This is why a project team may have programmers, product managers, operations, and everyone has different focuses; only by integrating these can a project move forward.If you seek a programmer to write it. I myself am not capable of writing code, so I also sought the help of a professional programmer to implement it for me. During our communication, there were many instances where we disagreed. More often, the functionalities I wanted to implement were beyond the programmer's ability, so we had to continuously refine, debug, compromise, and ultimately seek a balance. (But looking back, the trading results of the quantitative system were not as good as my own manual system).

There would be two minor issues here:

(1) The proficiency of the programmer in writing code determines the quality of the program. The first programmer I worked with had constant bugs during testing, which was a serious concern since we were dealing with real money. Therefore, I tested the complete quantitative program for more than half a year before I dared to start using it.

(2) Some people worry that by writing out their trading strategies for the programmer, they might leak their secrets. In fact, there is no need to worry about this issue, as the parameters of the program are usually not written in. For example, the programmer knows that your trading strategy uses a moving average, but he does not know what parameters of the moving average you are using, or what type of moving average. You can set some manually adjustable parameter standards in the program, which leaves some room for adjustment for your future strategy changes.

Step three: Test the quantitative program.

Place the program into the trading software and use historical data to test the profitability of the program. This process is usually quite lengthy, requiring many sets of parameters to be compared, and even backtesting with multiple products and parameter sets. Select the optimal parameters and the best products.

The optimal parameter combination is not the one with the highest profit, but one that takes into account the drawdown of funds during the program's operation, the cycle of drawdown, the use of position ratio, and so on.

After determining the optimal parameters, conduct simulated trading tests, which can be done simultaneously with multiple products. This way, a large number of backtests can be conducted, and if there are any bugs in the program, they will be revealed. Once the program is perfected and error-free, then it can be put into actual combat.

Having completed the above three steps, you have essentially realized the quantification of your own trading system.

Finally, let's discuss, can quantitative trading programs really solve the problem of execution?The answer is: No, the effect is very limited.

The reason is quite simple: whether it is manual trading or algorithmic trading, the emotional changes of traders are the same. This is because the control of the program is in the hands of the trader themselves.

Let's take an example: when your program enters a period of decline and your account suffers consecutive losses, seeing the money in your account constantly decrease, you will inevitably feel very anxious and fearful. As time goes on, it is highly likely that you will pause the program. If profits are generated, you will also be tempted to close the program to preserve the gains.

Once you manually intervene in the program, the consistency of the entire trading strategy is broken, and the final profit outcome changes, which is actually the same as manual trading. Therefore, whether it is a quantitative trading system or a manual trading system, the most fundamental problem to be solved is the issue of human nature.

The form of trading is not important; the human nature and mindset issues that need to be addressed are more important.

Comment