How to optimize an Automated trading system?
|The optimization of a trading system has been the consensus of programmers for a long time. A lot of software provide optimization function. However, we could not only focus on the higher profit after optimization. More scientific and systematic method is needed. This article gives a brief introduction.
Sample and setting
1. Tendency Forex System: Coded with JavaScript, no repaint, no Grid, no Martingale. Works on 240 minute timeframe for USDJPY, EURUSD and USD Index.
2. Historical Data Feed: eSignal charting system
3. Period: From Jan. 2010 to Oct. 2020
4. Initial Virtual Balance: $100k
5. Contract Size: Fixed 1 standard lot per trade
6. SPSS 24.0
7.GraphPad Prism 8.0
Methods and results
1. Backtesting with default setting
Figure1. Backtesting of USDJPY Periodical Analysis
Annual trading summary
Figure 2. Backtesting of USDJPY Equity curve Close to Close
2. Optimization optimization
We compared the optimization results of Tendency Forex System, SPSS 24.0 was used for statistical analysis. Studies’ parameters were displayed as Mean SD (Standard Deviation) for continuous variables. The comparison between the two groups was performed by t test. The comparison between multiple groups was performed by variance analysis and Dunnett's t test. A P value <0.05 was considered statistically significant for all analysis. The statistical charts were drawn by GraphPa d Prism 8.0.
2.1 Optimization was done year by year
Tendency Forex System was optimized with the historical data from 2010 to 2015 and got the "optimized setting for 2016", then calculated the total net profit in 2016 with the "optimized setting 2016";
Tendency Forex System was optimized with the historical data from 2010 to 2016 and got the "optimized setting for 2017", then calculated the total net profit in 2017 with the "optimized setting 2017";
And so on.
2.2 Optimization results
2.2.1 After optimization, the overall return was increased by at least 10% compared to the results of the default setting. It shows the optimization method is very effective. The details can be seen in Table 1 omitted
However, in the variance analysis on the Average Annualized Return, there was no statistically significant among multiple groups. F=0.218, P=0.953>0.05 The details can be seen in Table 2 omitted
Figure 3 variance analysis of the average annualized return
In theory, pairwise comparisons are only necessary if there is s statistical difference in variance analysis. However, for rigorous purpose, a Dunnett's t test was done with one group Default setting as a control group and compared all the other groups to it. All the Significance was higher than 0.05, further confirmed there was no statistically significant among multiple groups. The details can be seen in Table 3 omitted
2.2.2 The annualized net profit of 2016, 2017, 2018, 2019, and 2020 was calculated with the optimized settings. Compared with the default setting, although the annualized return in 2016 was significantly higher, the overall profit was reduced by nearly 30% The details can be seen in Table 4 omitted
However, in the t test of the Average Annualized Return, there was no statistically significant between the two groups. t= 0.706, p=0.500 0.05) The details can be seen in Table 5 omitted
Figure 4 t test of the average annualized return of default setting
Discussion
In Tendency Forex System, all the indicators are essentially using default settings. To our knowledge, over optimization is a major issue with most Algos, which can lead them to show excellent performance in the backtesting but then fail to work well in live forward trading. Too much data mining may be the problem. It more or less gets some results for example the 50 period Moving Average may be more sensitive for symbol A than symbol B but when you move from backtesting to a live forward test, this kind of system generally will not work. According to the statistical analysis, there is no value in optimizing the Tendency Forex System further.
Conclusion
To optimize an automated trading system, there are three essential things which should be kept in mind:
1. Fully understand its core logic and all the indicators included.
2. The quality of historical data feed: the higher the better.
3. Statistical analysis method must be used to measure the optimization result.
Information on these pages contains forward-looking statements that involve risks and uncertainties. Markets and instruments profiled on this page are for informational purposes only and should not in any way come across as a recommendation to buy or sell in these assets. You should do your own thorough research before making any investment decisions. FXStreet does not in any way guarantee that this information is free from mistakes, errors, or material misstatements. It also does not guarantee that this information is of a timely nature. Investing in Open Markets involves a great deal of risk, including the loss of all or a portion of your investment, as well as emotional distress. All risks, losses and costs associated with investing, including total loss of principal, are your responsibility. The views and opinions expressed in this article are those of the authors and do not necessarily reflect the official policy or position of FXStreet nor its advertisers.