|

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

Chart

Figure 2. Backtesting of USDJPY Equity curve Close to Close

Chart

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

Chart

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

 
Chart

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.

Free Trade Copy is available in FCA, Cysec, FINMA regulated Brokers.The Investor Compensation Fund is up to £85k, €20k, CHF 100k respectively.

Author

Yue Wang

Yue Wang

LinoCapital

Master's Degree in Hepatobiliary Surgery. 

More from Yue Wang
Share:

Editor's Picks

Crypto Today: Bitcoin, Ethereum, XRP stay under pressure as investors turn more risk-averse

The cryptocurrency market trades under intense headwinds on Wednesday, led by Bitcoin’s (BTC) deepening sell-off below $60,000. The Crypto King hovers above $58,000.

Pi Network holds on thin ice with 76 million tokens ready to be unlocked

PI is holding steady around $0.1150 on Wednesday, stabilizing after three consecutive days of losses of around 10%. Pi remains under pressure, with more than 76 million tokens scheduled for unlocking in June, potentially accelerating the bearish trend.

Bitcoin sinks to 21-month low amid ETF outflows, US-Iran peace uncertainty

Bitcoin stabilizes around $59,000 after falling to a 21-month low of $57,800 on Wednesday. Geopolitical uncertainty remains elevated after Iran ruled out talks with US envoys, clouding prospects for a peace agreement and keeping risk sentiment fragile.

Jupiter positions for a trend reversal as network activity picks up

Jupiter is up 6% on Wednesday, crossing above its 200-day EMA at $0.2192. Network data shows a spike in monthly revenue and fees in June to a three-month high.

Bitcoin: BTC hits 20-month low, will the pain continue?

Bitcoin has remained under pressure this past week, losing over 5% as traders assess mixed signals from different parties involved in the Middle East conflict.