Learn To STOP Curve Fitting!
Download this free guide on how to stop curve fitting. Following these four simple steps can improve your trading dramatically!
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.
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
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
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:
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 is the founder of System Trader Success - a website and mission to empowering the retail trader with the proper knowledge and tools to become a profitable trader the world of quantitative/automated trading.
Please log in again. The login page will open in a new window. After logging in you can close it and return to this page.