Premium Market Analysis

Price Action Strategies

E-mini S&P 500 Futures Machine Designed Trading System

This is an example of a machine designed trading system for the E-mini futures contract. The trading system was designed using data from 01/02/2001 to 12/31/2012.  Since the beginning of this year to 11/20/2013 the system return is 12.7% for initial trading capital of $50,000 per contract and this return turns out to be significant at the 80% level based on a simulation of 20,000 random systems.

The E-mini S&P 500 futures market is a challenging one to trade because of its high efficiency. As I have shown in another article, most intraday low frequency traders in this market are doomed because of the friction effect imposed by commission cost even at capital levels that result in little or no leverage. The chances of a profitable system are higher when operating in a short-term daily timeframe. Specifically, when the profit target and stop-loss are outside the daily change interval of about +/- 30 points, it may be possible to avoid curve-fitting the system signal to the noise. Nearly 95% of all daily changes lie within this range. In this example, Price Action Lab software is used to machine design a short-term trading system for this futures contract with a 40 point profit target and stop-loss. The system is designed on daily data from 01/02/2001 to 12/31/2012. Then it is tested on an out-of-sample from 01/02/2013 to 11/20/2013. The objective is to see what would have happened if someone designed this system at the end of 2012 and used it to trade the E-mini contract in 2013. An out-of-sample test before that is not made because the objective was not to cross-validate the specific method for the machine design of trading systems since that was already done in numerous posts. Hence, all available data are used to design the system.

Note that data-snooping bias is absent from this machine design  process because the parameters, like the profit target and stop-loss, performance metrics, etc., are set in advance and there is no optimization or change of the metric set based on out-of-sample results. Data-snooping is a common practice in trading system development that is extremely dangerous because it involves knowledge of future data when designing a system that will be evaluated using the same future data. Such practice almost guarantees getting fooled by randomness. In addition, and this is more important, all rules that are generated by the software are included in the final system without any filtering. This reduces data-mining bias to a minimum. As a counter-example, in the case of systems designed by genetic algorithms, a great number of systems will be fitted to the noise to satisfy the objectives and selecting the best performer(s) may introduce selection bias that must be measured by accounting for the performance of the non-selected rules.

Machine design process

The first step is to create a profit target and stop-loss file as shown below

ES_TRSThe profit target and stop-loss are set to 40. This file is saved as 40.TRS and the next step involves creating a search workspace:


The search workspace involves just one search line for the file ES.txt with a data range shown in File Date Range. The T/S file created before is also selected. The trade parameters are set to points for the target and stop and Open for entering positions. The minimum win rate of patterns is set at 66%, the minimum profit factor at 1.5, the minimum number of trades at 29 and the number of maximum consecutive losers at 8.


The search may take anywhere from 30 minutes to 2 hours depending on CPU speed. The results are shown below:


PAL found 17 long and 5 short patterns that met the objectives defined on the search workspace. The in-sample performance generated by PAL for single positions is shown below:


The CAR and percent return in the case of future contracts are evaluated based on face value at the start of trading. For more detailed performance results PAL can generate code for various platforms. Below is the Amibroker performance of the above set of price patterns in the in-sample and out-of-sample:


Below is a table of in-sample and out-of-sample performance parameters. The starting capital is $50,000 per contract and $3 commission and slippage was included per trade one-way:

Parameter In-sample Out-of-sample
Win rate 58.48% 56.25%
max DD -20.26% -8.48%
CAR 11.16% 14.49%
Profit factor 1.70 1.62
Sharpe ratio 1.44 1.02

The out-of-sample performance parameters are close or better to those of the in-sample. A total of 333 trades were generated in the combined sample. The net return for 2013 is 12.68% and it is annualized to 14.49%.

Analysis of system significance

A simulation of 20,000 random short-term trading systems for the E-mini futures market generated the following distribution of net returns ($50,000 capital per contract, $3 commission per contract per side):


Nearly 47% of the systems generated a positive return but as it turns out given the raw data of the distribution only 20% of them returned more than 12.68%. The returns ranged from -66% to +63% and the mean was -1.1%. We would like our system to have done better and rank profitable at the 95% or even 99% level but this requirement may be unrealistic. Of course, someone could decide to reject this system based on poor ranking but in the case of the E-mini futures market this is reasonable performance given the efficiency.

Comments and FAQ

How long will these patterns remain profitable? This is unknown. However, using Price Action Lab one can repeat the search every six months or one year, for example, and the systems can be upgraded. It is not like getting a black-box and having to live with it.

Is an out-of-sample test required before using a system? Actually, some people believe that out-of-sample testing is not needed after it is used to confirm that a certain process or method of finding trading systems leads to significant results. Thus, if it is shown than some machine design method can get significant results in an out-of-sample, then the process can be eliminated all together and all the available data can be used in a future search. Instead of doing out-of-sample tests, the search is rerun every six months and the system is rebalanced in a walk-forward mode. 

Disclosure: no relevant positions.
Charting program: Amibroker