October 14


FirstStrike Trading System, Part II

By Jeff Swanson

October 14, 2013

automated trading, breakout, EasyLanguage, ES, S&P Emini, stock index futures

When testing a trading system I will often start looking at the big picture first. That’s why during part one of this series of articles I started with looking at a bull/bear regime filter. This filter broadly divided the market into two modes: bullish and bearish. Trades would be taken in the direction of the overall market mode. The results of the regime filter were positive, although it did not make a huge difference with the net profit or profit factor. I decided to keep the regime filter since it did make the system more tradable. You could see this by viewing the equity curve and seeing it was much more linear with far less drawdown and shorter time between new equity highs.

Proper Input Optimization

Let’s continue to look at the regime filter. More specifically, the look-back period. I just picked a 220-period simple moving average when creating the regime filter. But what results do we get with other values? I’m going to use TradeStation’s optimize feature to test other values for two reasons. First, I hope to see a wide variety of values that produce positive results. This would provide confidence that the 220 value is not a lucky guess on my part. If our 220-period regime filter is a robust indicator that adds value to our trading system a wide variety of look-back values will be acceptable. That is, many values above and below 220 should also produce decent results. What we don’t want to see is large variation every time we modify the period on our regime filter because this means our filter is not very robust.

Our second reason for performing the optimization is to discover if our 220 day look-back value should be changed. If we are going to change it we don’t simply want to pick the best looking value. We would like to find a region where the values appear stable. That is, an area with little variation.

Here is what the optimization looks like based upon Net Profit. The look-back period for the regime filter is on the x-axis while the net profit is on the y-axis.

Trend Filter Look-Back Period vs Net Profit

Notice all values produce positive results between $25,000 and just under $60,000. This is a good sign. There is a positive cluster at the low end of the look-back periods between 20 and 60 that produce strong net returns. These small look-back values indicate our market regime filter is very quick to change market modes since the look-back period is so small. This will likely produce more trades and is probably not what we want. We want our regime filter to react slowly to capture the longer term market trend. Looking at the longer look-back values you see a spike at 120. This could be an outlier and should not be picked. Remember, we are not looking for the absolute best value but ideally, a range of similar values that indicate some stability. Let’s look at the values to the right of this spike. Between 120 and 260 we see some stability. The value 190 is right in the middle.

Another way to look at this distribution of look-back periods is by Profit Factor. See the chart below.

Trend Filter Look-Back Period vs. Profit Factor

Here we see a lot of stability across a good number of values. The range we are interested in, 120 – 260 appears stable. Finally, let’s look at it using Expectancy Score.

Trend Filter Look-Back Period vs. Expectancy Score

An Interesting Observation…

Looking across all the various look-back values we can see many  positive results. It was during this time I noticed something interesting between the long and short trades when varying the look-back period. To demonstrate let me breakout the look-back period into three different values: 45, 135 and 200. Below are the system performance metrics for these three different look-back periods.

45 Period Look-Back

All Trades

Long Trades

Short Trades

Total Net Profit




Gross Profit




Gross Loss




Profit Factor




135-Period Look-Back

All Trades

Long Trades

Short Trades

Total Net Profit




Gross Profit




Gross Loss




Profit Factor




225-Period Look-Back

All Trades

Long Trades

Short Trades

Total Net Profit




Gross Profit




Gross Loss




Profit Factor




Notice any patterns? Going from the smallest look-back period to the longest notice how the long net profit behaves. Then look at the short net profit. In general, the long profit does better with the shortest look-back period while the short trades perform better with a longest look-back period.

There are several things that could happen here. We can continue to run with using two simple moving average (SMA) indicators as bull/bear regime indicators or we can explore other possibilities for a regime indicator. In a previous article, Regime Testing Indicators, I talked about using other indicators for a regime filter. For now to continue with our current line of thinking I’m going to march ahead with using two SMA indicators. Our next step is to find the the look-back periods for both regimes. We will do this by testing the robustness of the indicator over many values and look for a stable region.

Look-Back Period For Longs

Here we will use TradeStration’s optimizer to explore the look-back period for long trades only. Below is a bar graph depicting the look-back period vs. net profit. We will be looking for a stable region.

Look-Back Period For Shorts

Here we will use TradeStration’s optimizer to explore the look-back period for short trades only. Below is a bar graph depicting the look-back period vs. net profit. We will be looking for a stable region.

Our Bull/Bear Regime Filter

Looking at the two bar graphs above I see no reason why I can’t use my original values of 45 and 235 for my look-back periods. These were unoptimized values based on creating equal 1/3 spacing between 20 and 260 – the original tested look-back period. Based on our recent find we will have a bull/bear regime filter that utilizes two different look-back periods. This will result in three possible actions: opening long trades, opening short trades or opening no trades. Unlike a typical bull/bear regime filter where we are either in a bull market or a bear market in this case we also define a zone where no trades are taken.


With our new bull/bear regime filter we generate the following results:

All Trades

Long Trades

Short Trades

Total Net Profit




Gross Profit




Gross Loss




Profit Factor




First Strike Performance


Single Regime Filter

Dual Regime Filter

Net Profit




Profit Factor




Total Trades








Avg. Trade Net Profit




Annual Rate of Return




Sharpe Ratio




Max Drawdown (Intraday)








Expectancy Score




That’s it for this week’s article. We’ll continue to develop this system in future articles. For now you can find the FirstStrike code containing the dual regime filter below. I would like to ask you, do you have any ideas or test results to help make this system better? Leave your thoughts and comments below. I have much more to test and share with you as we explore our testing. And just maybe, we’ll have a tradable system when we’re finished.

Jeff Swanson

About the author

Jeff has built and traded automated trading systems for the futures markets since 2008. He is the creator of the online courses System Development Master Class and Alpha Compass. Jeff is also the founder of EasyLanguage Mastery - a website and mission to empower the EasyLanguage trader with the proper knowledge and tools to become a profitable trader.

  • Hi Jeff,

    I would be very interested to see how performance would be affected if, at the time of each individual trade, the current optimal value at that time was used. This would have been the “best” information that would have been available in real-time (rather than with hindsight), and would therefore more closely simulate what could have been achieved in actual trading.

    Looking forward to seeing how this strategy develops!

  • Jeff,

    As always, interesting article. Got the system up and running on TradeStation. Was able to replicate your results. I am probably getting ahead of your articles. As is usual in the case with algo trading, I “walked forward” the data two years so that the last day was 12/31/2012. Needless to say, it did not do well. The equity curve nosed down immediately!
    I would be interested in what you find.

    Thanks for these articles, very much appreciated

    • I have yet to walk forward the results to the out of sample because that would defeat the purpose! Remember, you don’t want to test your system on the OOS data until you are finished because once you do, you are likely to start making decisions that will increase the chances of curve fitting the data as you continue to build the system within your development period. I have no idea if the finished system will work or not. But this is a good exercise in system building.

  • Thanks for sharing this good exercise.

    Following your logic with this dual regime fllter, you can open long trades, short trades or no trades.

    But what happens when prices are bellow SMA 235 and beyond SMA 45?

    Is it possible to open long and short trades? (First strike?)

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Learn To Code & Build Strategies
    Using EasyLanguage.