Catch Breakouts With an Inside Bar Trend Strategy!

May 5, 2021

Inside bars can be a valuable predictor of trend continuation. Here’s how you can program an inside bar, and use it to improve your trend following strategy!

You can download the strategy below from the Free Strategies section.

Trend following is a reliable income generator for many retail traders.

Jumping aboard a trend after a pullback or consolidation is a great way to improve your win rate and entry price.

Here I’ll illustrate how you can use inside bars to predict trend continuation for the M30 GBPJPY.

What is an Inside Bar?

An inside bar is one whose price range (candle wicks included) is completely within the price range of its preceding candle.

Algorithmically speaking, the inside bar’s high must be lower than the previous high, and the inside bar’s low must be higher than the previous low.

Market volatility is often cyclical in nature. Periods of intense activity are usually followed by periods of relative calm.

These inside bars indicate a brief period of calmness.

Market participants could be taking profits after riding the initial wave of a trend, or they could be awaiting a major news release.

During such periods of consolidation, any fundamental impetus (such as a positive economic report) can create a strong breakout.

Traders who were previously waiting on the sidelines quickly jump into the market, amplifying and sustaining the emerging trend. The longer the prior consolidation, the stronger the breakout tends to be.

Using Inside Bars for Trend Following

Inside bars can be used to predict trend reversals and continuations.

I’ll focus on trend continuations in this case.

This is the scenario I’ll try to capture when programming the inside bar strategy:

  1. A brief trend is followed by consolidation
  2. An inside bar occurs, indicating low volatility
  3. The market breaks out of the consolidation range, continuing the trend

Pattern recognition is often a weak point of algorithmic trading. Even patterns that are obvious to the human eye are difficult to convert into a set of black-and-white programming rules.

Let’s give it a shot.

Programming Inside Bars

To avoid going insane, I’m going to start with a very loose set of trading rules. Here’s the rules for detecting an uptrend continuation:

  1. An upwards bar occurs, meaning prices close higher.
  2. This is followed by an inside bar.
  3. Another upwards bar occurs.

Here’s how it looks like on a chart:

And now some quick programming with AlgoWizard:

The number in square brackets indicates the bar shift. [1] means the most recently completed bar, while [2] refers to the bar before that, and so on.

The rules for detecting downtrends are the opposite:

  1. A downwards bar occurs, meaning prices close lower.
  2. This is followed by an inside bar.
  3. Another downwards bar occurs.

And in AlgoWizard:

Simple programming rules like these help minimize the risk of curve fitting.

Programming Entry Filters

While simple entry conditions are generally good, I need to minimize the chance of catching false breakouts.

I’ll add two entry filters to help with this – A long-term trend filter, and a stop order filter.

1. Trend Filter

With this filter, I will only trade in the direction of the long-term trend.

Long trades will only be taken when prices close above the 100-period exponential moving average (EMA).

Conversely, shorts will require the close to be below the 100-period EMA.

2. Stop Order Filter

When the above entry conditions are met, a buy stop will be placed at the previous high. This means I’ll only enter the market after seeing some evidence of trend continuation.

For shorts, the sell stop will be placed at the previous low.

Finally, for risk management, I’ll throw in a 120-pip trailing stop and exit all trades on Friday.

With all the entry conditions above, a long entry now looks like this:

And a short entry:

Backtesting the Inside Bar Trend Strategy

As usual, I run a 10-year backtest to verify that the strategy has some long-term edge.

The GBPJPY is known to trend pretty well. Are the results above purely due to the choice of market?

To find out, I removed the inside bar conditions. The strategy now places buy/sell stops when prices close above/below the 100-period EMA, respectively.

I wouldn’t touch that with a ten-foot pole.

I’ve found that adding some sort of pullback/consolidation filter, like the inside bar conditions in this case, usually improve your trend following strategy.

Wrapping Up

Inside bars represent volatility contraction and commonly appear when a trend is consolidating.

A breakout of the consolidation range gives you an opportunity to jump onboard the trend.

The entry conditions above should be used as a starting point. You can improve your win rate by being more selective with your inside bars.

Ideally, you want to see the classic ‘Harami Cross’ pattern:

  • A very small range relative to the previous bar
  • A thin real body, indicating indecision in the market

Another way to get better bang for your buck is to enter on a pullback. I’ve previously written about using the CCI and QQE indicators to detect short-term pullbacks.

If you want the backtest the inside bar strategy above, you can download it from the Free Strategies section.

Powered By

Development Platform

Forex VPS

FXVM Forex VPS

Popular 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

Make your money work for you!

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

Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Trading Strategies

What’s the Best Time to Trade Forex?

What’s the Best Time to Trade Forex?

The forex markets are open 24/5, but not all hours are created equal. Here I dissect my broker data to determine the best time to trade forex.

Forex Weekend Gaps: Can You Exploit Them?

Forex Weekend Gaps: Can You Exploit Them?

Have you noticed that forex weekend gaps usually reverse within 3 days? Here I’ll program a mean reversion strategy to exploit gaps over the last 18 years!

Money Flow Index: An Improved RSI?

Money Flow Index: An Improved RSI?

The Money Flow Index is sometimes called the volume-weighted RSI. Can it outperform the RSI in this trend following strategy?

Automated Bollinger Bands Squeeze Forex Strategy

Automated Bollinger Bands Squeeze Forex Strategy

StrategyQuant’s BBWR indicator is the perfect tool to detect a Bollinger Bands squeeze. Here I explain how it’s calculated, and use it to program a breakout strategy for the AUDJPY!

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.

Can a Trading Pause Improve Your Trend Following Results?

Can a Trading Pause Improve Your Trend Following Results?

A temporary trading pause can improve your win rate if you’re trend following a volatile market. Here I’ll program a trading pause into a simple breakout strategy, and test its effectiveness on the Widow Maker – the GBPJPY.

Laguerre RSI Trend Following Strategy

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!

How to Use the Supertrend Indicator

How to Use the Supertrend Indicator

Despite its cool name, the Supertrend indicator often seems to slip under the radar. Here I explain how it’s calculated, and combine it with moving averages to produce a simple trend following strategy.

Ichimoku Trend Following Strategy

Ichimoku Trend Following Strategy

Like candlesticks, the Ichimoku indicator is a fine Japanese creation. Here I’ll explain how the Ichimoku is plotted, and use it to build a trend following strategy for the USDJPY.

Strategy Development

Do You Know Your System Quality Number?

Do You Know Your System Quality Number?

The System Quality Number measures the profitability & consistency of your trading system. Here’s how to calculate your SQN and use it to improve your trading!

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.

Do You Know Your Strategy’s Optimization Profile?

Do You Know Your Strategy’s Optimization Profile?

Your strategy’s optimization profile often reveals its robustness, helping you select strategies that will remain profitable in live trading. Here I explain why an optimization profile is important, and how you can easily obtain one using StrategyQuant’s optimizer.

Which MT4 Backtest Report Metrics Should You Use?

Which MT4 Backtest Report Metrics Should You Use?

Understanding your backtest report is an essential part of being a successful strategy developer. Here I explain what the numbers mean, and how you can make use of each metric during strategy development.

Out-of-sample Testing Using Monte Carlo Simulations

Out-of-sample Testing Using Monte Carlo Simulations

Traders often use Monte Carlo simulations to estimate worst-case drawdowns, but did you know they can be used for out-of-sample testing too? This post demonstrates the use of StrategyQuant’s Monte Carlo simulator to randomize historical prices and strategy parameters, helping you select robust strategies for live trading.

How Many Trades Should Your Backtest Have?

How Many Trades Should Your Backtest Have?

We all want a large sample of trades in our backtests, but practical limitations such as data availability often get in the way. Here I’ll explain why 30 trades is insufficient, and how you can use standard error to quantify the uncertainty arising from a small sample size.

Build a Diversified Portfolio With QuantAnalyzer

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.

Strategy Optimization Using MT4

Strategy Optimization Using MT4

How do you improve your trading strategy in MT4? This post will show you how to optimize the entry and exit parameters for a moving average crossover strategy. Finally, an intraday time filter will be added to help avoid false breakouts.

Debugging & Backtesting Using MT4

Debugging & Backtesting Using MT4

With a fresh algorithm at your fingertips, how do you verify that it has been programmed correctly? This guide will show you how to use Metatrader 4’s visual backtester to debug and backtest your strategy.

Create Your Trading Algorithm in 15 Minutes (FREE)

Create Your Trading Algorithm in 15 Minutes (FREE)

Converting your trading idea into an algorithm is the first step towards reaping the benefits of automated trading. This guide will cover the creation of a simple moving average crossover algorithm, without any actual programming.

What Is Drawdown in Trading?

What Is Drawdown in Trading?

Are you getting a comprehensive assessment of your strategy’s downside? This post will discuss several methods to measure drawdowns, helping you build and select strategies that better suit your risk appetite.

Live Trading

What’s the Best Time to Trade Forex?

What’s the Best Time to Trade Forex?

The forex markets are open 24/5, but not all hours are created equal. Here I dissect my broker data to determine the best time to trade forex.

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.

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.

How to Select the Best Forex VPS

How to Select the Best Forex VPS

A virtual private server (VPS) is a virtual computer that you can rent and access remotely. It provides a reliable platform on which to execute your forex strategies. This post will help you decide whether you need a VPS, and show you how to select an optimal VPS.

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