An example of a back test on an automated mean reversion trading system. How algorithms can help automate the trading process.

Automated trading systems make it easier to enter and exit trades according to set rules. While an algorithm can’t have the decision making capabilities of a human trader, it does perform routine tasks better. An automated system can also avoid emotional based trading systems, such as ‘revenge trading’.

This back test was performed on the  Sierra Chart charting and trading package. It’s a great piece of software at a reasonable price considering it’s advanced functionality. Automated strategies can be created using their ASCIL programming language, or using an integrated spreadsheet trading system.

The results from the 5 year back test can be found below. The system buys when the market is a certain distance below an average daily price, and sells at a certain distance above.  The high/low levels are based on a wide variety of factors, which the algorithm constantly processes. It is designed to be a day-trading system, closing all trades at the end of the trading day. The product traded in this example if the ES futures contract based on the S&P500 US Stockmarket index.

The chart demonstrates an overall profitable performance, with the final year having the strongest results. The fact that it can survive what has been essentially a strongly trending market, is good for a mean reversion system. There are significant drawdown’s, which could make the system unsuitable for some traders. However, in order to reduce the draw-down, a system of avoiding trending markets could be applied.. This could be done manually by identifying a strongly trending day, and deactivating the algorithm, or an automated system could detect trend type behavior.

5 Year backtest. Mean Reversion trading algorithm.

Below is a more in-depth analysis of the back-test performance.

Trade Statistics Back Test Start Date
ES Futures contract 2016-01-27
Currency Value ($)
Closed Trades Profit/Loss 142290
Closed Trades Total Profit 657527.5
Closed Trades Total Loss -515237.5
Profit Factor 1.28
Equity Peak 143292.5
Equity Valley 25720
Maximum Runup 117572.5
Maximum Drawdown -42777.5
Maximum FlatToFlat Trade Open Profit 16062.5
Maximum FlatToFlat Trade Open Loss -38687.5
Average Trade Open Profit 231.96
Average Trade Open Loss -305.34
Average Winning Trade Open Profit 302.69
Average Winning Trade Open Loss -173.08
Average Losing Trade Open Profit 108.27
Average Losing Trade Open Loss -536.63
Maximum Trade Open Profit 2600
Maximum Trade Open Loss -4037.5
Highest Price During Positions 0
Lowest Price During Positions 0
Total Commissions 21235
Total Trades 4247
Total FlatToFlat Trades 403
Total Filled Quantity 8494
Percent Profitable 63.62%
FlatToFlat Percent Profitable 68.49%
Winning Trades 2702
Winning FlatToFlat Trades 276
Losing Trades 1545
Losing FlatToFlat Trades 127
Long Trades 2226
Long FlatToFlat Trades 226
Short Trades 2021
Short FlatToFlat Trades 177
Average Trade Profit/Loss 33.5
Average FlatToFlat Trade Profit/Loss 353.08
Average Winning Trade 243.35
Average FlatToFlat Winning Trade 2243.26
Average Losing Trade -333.49
Average FlatToFlat Losing Trade -3754.72
Average Profit Factor 0.73
Average FlatToFlat Profit Factor 0.6
Largest Winning Trade 1945
Largest FlatToFlat Winning Trade 15562.5
Largest Losing Trade -3330
Largest FlatToFlat Losing Trade -31347.5
Largest Winner % of Profit 0.30%
Largest FlatToFlat Winner % of Profit 2.51%
Largest Loser % of Loss 0.65%
Largest FlatToFlat Loser % of Loss 6.57%
Max Consecutive Winners 75
Max Consecutive Losers 54
Average Time In Trades 3:48:06
Average Time In Winning Trades 3:12:17
Average Time In Losing Trades 4:50:45
Longest Held Winning Trade 11:17:00
Longest Held Losing Trade 9:02:57
Total Quantity 4247
Winning Quantity 2702
Losing Quantity 1545
Avg Quantity Per Trade 1
Avg Quantity Per FlatToFlat Trade 10.54
Avg Quantity Per Winning Trade 1
Avg Quantity Per FlatToFlat Winning Trade 9.72
Avg Quantity Per Losing Trade 1
Avg Quantity Per FlatToFlat Losing Trade 12.32
Largest Trade Quantity 1
Largest FlatToFlat Trade Quantity 42
Maximum Open Position Quantity 42
Last Trade Profit / Loss 157.5
Number of Open Trades 0
Open Trades: Open Quantity 0
Open Trades: Average Entry Price 0
Consecutive Winners Frequency
1 Winners 31
2 Winners 24
3 Winners 4
4 Winners 10
5 Winners 6
6 Winners 5
7 Winners 5
8 Winners 9
9 Winners 5
10 Winners 2
11 Winners 5
12 Winners 4
13 Winners 5
14 Winners 4
15 Winners 7
16 Winners 4
17 Winners 6
18 Winners 1
19 Winners 5
20 Winners 3
22 Winners 3
23 Winners 4
24 Winners 3
25 Winners 1
26 Winners 3
27 Winners 4
28 Winners 2
29 Winners 1
30 Winners 1
31 Winners 4
32 Winners 1
33 Winners 1
34 Winners 1
35 Winners 2
36 Winners 1
37 Winners 2
38 Winners 2
44 Winners 1
45 Winners 1
46 Winners 1
48 Winners 2
55 Winners 1
56 Winners 1
57 Winners 1
64 Winners 1
67 Winners 1
75 Winners 1
Frequency
Consecutive Losers Frequency
1 Losers 46
2 Losers 22
3 Losers 17
4 Losers 12
5 Losers 10
6 Losers 7
7 Losers 6
8 Losers 12
9 Losers 3
10 Losers 5
11 Losers 4
12 Losers 4
13 Losers 2
14 Losers 8
15 Losers 3
16 Losers 4
18 Losers 3
19 Losers 2
20 Losers 5
21 Losers 1
23 Losers 1
24 Losers 4
26 Losers 2
28 Losers 1
30 Losers 2
32 Losers 1
34 Losers 1
37 Losers 1
39 Losers 1
42 Losers 1
54 Losers 1

About the author

Trading and Investment

Traded the markets for over 15 years, including Commodities, Bonds, Currencies, Equities, and Indices. I have also worked as a Chartered Financial Planner.
CeMAP, CeFA, DipFA, AdvDipFA, Ba(Hons) Economics, Chartered ALIBF

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.