Trading Strategy Filter Selection

Filters impose additional constraints upon your entry signals. They typically benefit the strategy by improving its win rate, or by preventing entry during periods of elevated market risk.

Adding filters will invariably reduce the number of trades in your backtest, possibly making its results less reliable. The performance improvement must thus be significant enough to justify this downside.

After the conclusion of exit selection, our hourly GBPJPY trend strategy now contains three optimizable parameters:

  1. 85-bar lookback for the CCI entry
  2. 180-pip catastrophic stop loss
  3. 240-bar time stop

To make the strategy as simple and robust as possible, only one filter will be added in this final stage. The performance metrics used will be similar to those in exit testing.

Filter Selection Testing

Most entry filters usually fall into one of these three categories:

  • Time filters
  • Trend filters
  • Volatility filters

1. Time Filters

Although the forex markets are open 24/5, trading volumes vary significantly throughout the day. The various phases of liquidity correspond to the business hours of the major financial centres of the world. Majority of market movement happens during the London and New York hours. Markets are relatively quiet during Asian hours, except for perhaps the JPY pairs. The chart below shows the approximate business hours of each region.

Time filters seek to exploit the different phases in market activity throughout each trading day. Breakout or trend strategies rely on strong market participation to keep prices moving, whereas countertrend strategies perform better in quiet markets where most price movement is simply noise.

There are two common time filters: intraday time filters and day-of-the-week filters. Intraday time filters restrict trade entries to certain hours of the day. An example of an intraday time filter applied to a moving average trend strategy is illustrated here.

Day-of-the-week filters only allow trading on certain days of the week. Like the hour of the day, the day of the week also affects market activity. Mondays usually exhibit lower volatility, while trading on Friday can be tricky due to the release of major USD economic indicators and the unwinding of trading positions before the weekend.

Since our hourly GBPJPY trend strategy is likely to hold positions for days, an intraday time filter does not seem to make much sense. Instead, let’s test whether avoiding entry on a particular day of the week will improve our performance.

The strategy performs best when entries are prohibited on Wednesday, but the improvement in NP/DD is too small to justify the addition of this filter. The best entries seem to occur on Monday and Friday; excluding these days leads to the largest drop in performance.

It seems logical to jump onboard a nascent trend on Monday, which will likely be fueled by increasing volume later in the week. The success of the Friday entries is a surprise though. Perhaps the high-impact news allowed the strategy to capture a large chunk of profit.

2. Trend Filters

Trading in the direction of the long-term trend increases your probability of success. The long-term trend direction can be determined by using longer lookback periods, or by applying your indicators to a higher timeframe.

Let’s experiment with two conceptually different indicators for our trend filter. The first will be an exponential moving average, while the second will be the midpoint of the Donchian channel.  For our trend strategy, long entries will only be taken if the price closes above the EMA or the Donchian channel midpoint. Conversely, prices need to close below the EMA/Donchian midpoint for shorts.

We will apply the trend filter on the same hourly timeframe, but will optimize longer lookback periods in the 20-200 range.

The Donchian midpoint trend filter is the better performer, although the peaks in the 130-170 period range are not particularly stable. Note that for lookbacks below 80 periods, both filters have almost no effect. This is likely because our CCI entry uses an 85-period lookback.

Let’s see if volatility filters will fare better.

3. Volatility Filters

Quiet markets offer little profit potential for trend strategies, while extremely volatile markets may overwhelm your strategy with false signals.

Low-pass volatility filters only allow trading when volatility is below a certain target level. This may be useful to avoid trading during the release of interest rate decisions or high-impact economic reports. High-pass volatility filters require volatility to be above a certain level, and may help skip false breakout signals. For our trend following strategy, a high-pass filter seems more relevant.

Volatility filters commonly use pip or dollar-based thresholds. An example would be to only allow trading when the average true range or standard deviation exceeds a certain number of pips.

Using a pip-based threshold is simple, but has some limitations. Volatility levels vary across the markets, and a high-pass filter on a quiet market will have little effect on a volatile market. To recap, from the Market Research section, we determined that historical volatility often varies substantially across markets.

If you are developing your strategy on a basket of markets, such a filter may work poorly on some markets.

To circumvent this, let’s compare a short-term volatility measure to a longer-term volatility threshold within the same market. The short-term measure will be the prices’ high-low range over a certain lookback period, while the longer-term threshold will be a multiple of the 5-period daily ATR.

85 bars will be used for the lookback period, similar to that used in our CCI entry. Thus entries will only occur if the difference between the highest and lowest prices over the past 85 periods exceeds this daily ATR multiple. This multiple will be optimized from 0.01-1.

Net profit/max drawdown and the number of trades are plotted below as a function of the ATR multiple.

There is a high plateau in the 1.7-2.0 multiple region. I will select a multiple of 1.86 for our daily ATR threshold.

Volatility filters have great potential to improve performance, but at the expense of your number of trades. With this filter, the number of trades has dropped to 187 over 5 years, a drop of 40%. This translates to about 0.7 trades per week on average, and I consider this acceptable if a portfolio of strategies is traded. The improvement in performance metrics is shown below.

Net profit/max drawdown has increased significantly, and our expectancy has almost doubled.

With our entry filter now in place, let’s look at the full MT4 backtest report below.

Two points come to mind:

  1. The strategy only has a 43% win rate, but the average winner is 2.35x the average loser. Such statistics are typical of trend following strategies.
  2. There was a run of 7 consecutive losses in the 5-year backtest. Even with a decent strategy, you should expect to eventually suffer a lengthy losing run. This highlights the importance of position sizing, which will be addressed during portfolio composition. You have to be in it to win it.

Wrapping Up

A high-pass volatility filter has been added to our hourly GBPJPY trend strategy. This filter only allows trading when short-term volatility is relatively high, thereby avoiding some ‘whipsaw’ trades where the market is mostly moving sideways. Time and trend filters did not improve the trading solution in this case.

This concludes the MT4 development section. The purpose of these articles has been to illustrate one of the many possible ways to manually develop an algorithmic trading strategy using MT4 only. You can use this trading strategy as-is, but I encourage you to create a strategy that suits your own trading preferences.

Throughout development, there was a focus on maximizing risk-adjusted returns as determined by the net profit/max drawdown ratio. Position sizing was not applied; this will be done during portfolio composition.

The complete trading strategy can downloaded here.

The next few articles will address strategy development using StrategyQuant. Apart from automatic strategy generation, StrategyQuant offers a number of inbuilt robustness tests, making development both faster and easier.

Areas for Improvement

If you decide to develop your own strategy using MT4, you may wish to expand upon the process described above in the following areas:

1. Length of backtest period

For brevity, only the most recent 5 years of GBPJPY history was used for development here. Try to use all the price data you have available. This will both increase your number of trades, and help your strategy adapt to different market conditions.

2. Number of markets used for development

You can improve your strategy’s robustness by developing it across numerous markets. Choosing the markets to include in your development may not be straightforward though. As a first pass, you could exclude traditionally ranging markets if you are developing a trend strategy.

3. Combining or tweaking traditional indicators

A simple entry was illustrated using a default CCI indicator. Using a combination of indicators, with one confirming the other, may lead to better results. Also feel free to unleash your creativity to tweak indicators to suit your preferences.

Strategy Development Roadmap

Supercharge your strategy development with StrategyQuant

Access 14-day FREE trial here!

Get up to USD 300 discount!

Strategies need improvement?

Use QuantAnalyzer’s powerful analysis tools

Try the FREE version here!

Get 20% Discount here!

FXVM Forex VPS
Follow Us

Recent Posts

Laguerre RSI Trend Following Strategy

The Laguerre RSI attempts to improve the responsiveness of the regular RSI, whilst keeping whipsaw trades to a minimum. Let’s see how well it detects short-term pullbacks for a trend following strategy!

read more

What is Fixed Ratio Money Management?

Have you heard of fixed ratio money management? How does it compare to the popular fixed fractional approach? Here I’ll explain how fixed ratio works, and see how it stacks up against fixed fractional money management.

read more

Build a Diversified Portfolio With QuantAnalyzer

The ability to efficiently trade a diversified portfolio of strategies is one of the biggest advantages of algorithmic trading. Here we will use QuantAnalyzer’s Portfolio Master to build a portfolio consisting of high performing, uncorrelated strategies.

read more

What Is the QQE Indicator?

The QQE is a mysterious indicator that sometimes pops up in trading forums. Does it deserve a place alongside the more traditional momentum indicators like the RSI and CCI? Let’s add it to a trend following strategy to find out!

read more

Hey there, Wayne here! I’m on a mission to develop robust algorithmic trading strategies for the forex markets. Trading Tact is where I share my trading methods and insights.

Follow Us
Have a Question?

Comments

0 Comments

Submit a Comment

Your email address will not be published.

Supercharge your strategy development with StrategyQuant

Access 14-day FREE trial here!

Get up to USD 300 discount!

Strategies need improvement?

Use QuantAnalyzer’s powerful analysis tools

Try the FREE version here!

Get 20% Discount here!

FXVM Forex VPS

Recent Posts

Should You Use the Kelly Criterion for Forex Trading?

Should You Use the Kelly Criterion for Forex Trading?

The Kelly criterion is a famous mathematical formula that attempts to maximize your long-term capital growth. In this post, I’ll apply it to a EURUSD breakout strategy and explain some of its potential shortcomings when applied to forex trading.

read more
How to Find a Real Trading Guru

How to Find a Real Trading Guru

Every day I come across a trading guru offering educational content on the internet. Many of them speak of huge returns with minimal effort. Should these be trusted? Here’s some tips on how to separate the wheat from the chaff.

read more
How to Enjoy Stress-Free Trading

How to Enjoy Stress-Free Trading

Trading is a great way to make some additional income, but not if you’re constantly pulling your hair out. Here I offer 7 tips to help make your trading profitable and stress-free.

read more
How to Get a Realistic Backtest Spread

How to Get a Realistic Backtest Spread

Your choice of backtest spread can certainly make or break a strategy. This post will show you how to study the intraday spread variations of your market, and suggest several ways to avoid paying ridiculous spreads.

read more

Hey there, Wayne here! I’m on a mission to develop robust algorithmic trading strategies for the forex markets. Trading Tact is where I share my trading methods and insights.

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Pin It on Pinterest

Share This