A Simple S&P System

August 25, 2014 5:00 am9 commentsViews: 5356

Last week’s 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.

Simple_S&P_Baseline_Example_Trades

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 1998 through December 31, 2012
  • 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.

Simple_S&P_Baseline_EQ_Curve Simple_S&P_Baseline_Drawdown

 

Simple S&P System Baseline

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.

The first thing to do is to test various look-back values for the simple moving average indicator. Using TradeStation’s optimization feature I’m going to test look-back values between 10 – 200 in increments of 10. The results are depicted in the bar graph below where net profit is on the y-axis and the look-back period is on the x-axis.

Simple_S&P_Regime_Test

We can clearly see there is a general trend of diminishing profit as you increase the length of the look-back period. Values 30 and 40 appear to be outliers. I decided to choose the value 20. This represents about a month’s worth of trading. Other values, such as 50, 60, 70, 80 and 90, will probably produce similar results. After applying the regime filter we get the following results:

 

Simple_S&P_Regime_EQ_Curve

Simple_S&P_Regime_Drawdown

Simple System With Regime Filter

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 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.

Simple_S&P_VIX_BarGraph

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

Simple_S&P_VIX_EQ_Curve Simple_S&P_VIX_Drawdown

 

Simple System VIX Results

 

It’s rather an interesting fact that both the regime filter and volatility filter create about the same number of net profit. Furthermore, like the regime filter we see an improvement in many of the performance indicators such as profit factor, average trade net profit and reduced drawdown.  The regime filter does get to $34,000 in net profit more effectively with only 198 trades when compared to the volatility filter.

Overall, I like the equity curve and performance of the VIX filter over the Regime filter. Both represent an improvement over the original 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. Just for curiosity I did run the VIX filter system up to the current date and the system continues to make new equity highs into 2014.

Downloads

Jeff is the founder of System Trader Success – an inBox magazine dedicated to sharing great ideas and concepts from the world of automated trading systems. Read More Google

Facebook Twitter 

Tags:

9 Comments

  • 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

    • 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”.

      • 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.

      • 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.

        • 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.

          • 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?

          • 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.

  • 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

    • Marco, that certainly would be worth testing! As usual there are many things that could be done to potentially help improve the performance. Thanks for the idea.

Leave a Reply


Time limit is exhausted. Please reload CAPTCHA.

LEARN HOW TO OPTIMIZE WITHOUT 
CURVE FITTING

Download these four simple steps to help ensure you make money on the live market!

x