A Simple S&P System

In a past article, Trading Ideas And Systems: Keep It Simple, Smart Guy, highlighted the virtues of building simple trading systems. Simple trading systems have a lot of advantages namely, being robust. In this article I want to provide the EasyLanguage code for the concept provided in the orginal article. It’s a fine example of following the keep-it-simple mantra and just might inspire you to create a profitable system.

Simple S&P Futures System

The first system is based upon the concept provided in last week’s article. The rules are provided below.

System Rules

  • If today’s close is less than the close 6 days ago, buy (enter long).
  • If today’s close is greater than the close 6 days ago, sell (exit long).

Below is a screenshot of the system in action on the daily chart of the E-mini S&P futures contract.

Environmental Settings

I coded the above rules in EasyLanguage and tested it on the E-mini S&P futures market going back to 1998. Before getting into the details of the results let me say this: all the tests within this article are going to use the following assumptions:

  • Starting account size of $25,000
  • Dates tested are from January 1, 2000 through December 31, 2018
  • One contract was traded for each signal
  • The P&L is not accumulated to the starting equity
  • $30 was deducted per round trip for slippage and commissions
  • There are no stops

Baseline Results

Below is the equity curve for trading the E-mini futures contract based upon the rules as defined above. The equity curve looks very similar to the one from the original article. Below the equity curve is the weekly drawdown as a percentage of equity. We can see it reaches down in to the 40% range.

Baseline

Net Profit

$58,895

Profit Factor

1.33

Total Trades

421

%Winners

70.8%

Avg.Trade Net Profit

$139.89

Annual Rate of Return

6.65%

Max Drawdown(intraday)

$37,457

Would anyone really trade this? Of course not, but that’s not the point. The point is simple rules can be rather powerful and be the start of a great system. Can we take this trading concept and take it to a few more steps closer to a real system? Let’s see…

Bull/Bear Regime Filter

You can probably guess this would be my first line of attack. That is, broadly divide the market into two distinct modes: bullish or bearish. Often a simple indicator such as a simple moving average applied to a daily bar chart can be very effective in dividing a market into a bullish or bearish regime. The idea in this case is to only take long trades when we are in a bull market. I will be using a simple moving average to act as my regime filter.

In this case I'm gonig to use a 200-day simple moving average for the bull/bear regime filter. After applying the regime filter we get the following results:

Baseline

Regime Filter

Net Profit

$58,895

$49,957

Profit Factor

1.33

1.52

Total Trades

421

286

%Winners

70.8%

74.1%

Avg.Trade Net Profit

$139.89

$174.68

Annual Rate of Return

6.65%

6.03%

Max Drawdown(intraday)

$37,457

$15,537

So, does this look like an improvement? While we make less money, the system is more effective overall, in my opinion. The profit factor increases as does the average net profit per trade. We also reduce the max drawdown by a lot. I would guess we are eliminating a number of losing trades by only taking trades during a bull market.

Volatility Filter

Another way to divide the market is through volatility. Markets go through periods of rising volatility and falling volatility. In general, market volatility rises and peeks as the market falls and makes new lows. Some systems do well during these high volatility times while others do better during more quiet times. How are we going to measure volatility? We’re going to use the VIX index.  The VIX is a popular measure of the implied volatility of S&P 500 index options and is often called the fear index. In general, the VIX represents a measure of the market’s expectation of volatility over the next 30 days. The VIX has an inverse relationship to the price action on the S&P. Thus, we often see the VIX making new highs as the market is making new lows.

I’m going use the VIX in a very simple manner. I’m going to take the average of the daily VIX value over a number of days to create a simple moving average. Trade will only be opened when the current VIX is below the moving average. This should help the system by only taking trades when the VIX is likely to be falling.

But what value to use for the look-back? Using TradeStation’s optimization feature I’m going to test look-back values between 5 – 60 in increments of 5. The results are depicted in the bar graph below where the net profit is on the y-axis and the look-back period is on the x-axis.

The value 30 looked like a reasonable value to pick. The results of using 30 for the simple moving average for the VIX is below.

Baseline

Regime Filter

Volatility Filter

Net Profit

$58,895

$49,957

$34,427

Profit Factor

1.33

1.52

1.42

Total Trades

421

286

252

%Winners

70.8%

74.1%

59.4%

Avg.Trade Net Profit

$139.89

$174.68

$136.62

Annual Rate of Return

6.65%

6.03%

4.62%

Max Drawdown (intraday)

$37,457

$15,537

$18,560

Like the regime filter we see an improvement in profit factor, and drawdown from the baseline. But when comparied to the Regime Filter, this volatility filter underperforms in my opinion. 

Just for curiosity I performed one more test with VIX. That involved inverting the filter. That is, only take trades when VIX is above its moving average. Below are the results. 

Baseline

Regime Filter

Volatility Filter

Volatility Filter (inverted)

Net Profit

$58,895

$49,957

$34,427

$42,245

Profit Factor

1.33

1.52

1.42

1.29

Total Trades

421

286

252

291

%Winners

70.8%

74.1%

59.4%

72.2%

Avg.Trade Net Profit

$139.89

$174.68

$136.62

$145.17

Annual Rate of Return

6.65%

6.03%

4.62%

5.28

Max Drawdown (intraday)

$37,457

$15,537

$18,560

$26,460

I think the inverted run shows the least improvement against the baseline. It's also clearly not as good when compared to the standard Volatility Filter. What I really don't like is the increased drawdown and reduction in profit factor. More money is made with the inverted volatility filter vs the standard voltaility filter but, at a cost!

Overall, I like the equity curve and performance of the Regime Filter over the VIX Filter. Both represent an improvement over the baseline concept and demonstrate how simple concepts can produce positive results. Added one of the filters to the baseline concept was a “next step” to a potential profitable system. Clearly, more work needs to be done

About the Author Jeff Swanson

Jeff is the founder of EasyLanguage Mastery - a website and mission to empowering the EasyLanguage trader with the proper knowledge and tools to become a profitable trader. Join our EasyLanguage FaceBook group to interact with other EasyLanguage traders! Click the FaceBook icon to join.

follow me on:
  • Thomas says:

    May I use this example to ask a more general question? You optmize a higher frequency component (baseline system) together with a lower freqency component, the MA based market filter. Is there not -in general – a much longer periode of data for the market filter required to be significant?

    In the special case a simple MA may generate just enough trades in 14 years, but what about a little more complex filter like a MA crossover?

    Thomas

    • Jeff Swanson says:

      Hello Thomas. Not sure I understand your question. The baseline system look-back values were not optimized with the SMA filter. A short period SMA shows significance given the length of the historical data and the number of samples. Longer look-back periods showed a steady decline in performance. A more complex filter is worth testing, but I wanted to keep with the theme of the article which was “simple”.

      • Thomas says:

        Lets assume, a market filter switches the regime once a year. In order to be statitically significant it may require 30 or more years of data. My question is, if it is correct to optimize the baseline system together with the baseline system, if you use only 12 years of data, or if it is better to use standard parameter.

      • Thomas says:

        Corrected: Lets assume, a market filter switches the regime once a year. In order to be statitically significant it may require 30 or more years of data. My question is, if it is correct to optimize the baseline system together with the market filter, if you use only 12 years of data, or if it is better to use standard parameter for the filter.

        • Jeff Swanson says:

          In my opinion, it’s not the years of data that is important. It’s the number of trades and the market conditions covered. With over 100 trades (samples) spanning both prolonged bull/bear markets I would say our 12 years of data is statistically significant. You can optimize the regime filter along with the baseline. It’s more ideal to do it separately. Alternatively, using a walk forward optimizer to optimize the regime filter with the baseline would most likely give you the most realistic results.

          • Thomas says:

            Thank you for your proposal. I made a stand alone walk forward analysis of a simple MA crossover on the S&P500 and changed the size of the in-sample window to see how long does it take to train the market filter. In order to get a more ore less steady equity curve a 5 year window seems to be required. The resultig system makes around 2 trades per year.

            With this results in mind I would like to ask my question again. Assume you have a system with a statistically significant amount of trades. Don’t you loose significance if you add a low frequncy market filter and optimize the complete system?

          • Jeff Swanson says:

            In general yes. To another point in regards to your specific system, did you try your system on the S&P cash market? This goes further back than the futures market and may allow you to get more trades.

  • Marco says:

    Perfect system development as usual Jeff! What about using volume another filter different from price? Usually in my testings it helps a lot.

    http://nightlypatterns.wordpress.com

  • >