Breakout Strategy on Hourly Bars: How Does It Work? Example on Gold

by Andrea Unger

Need More Help? Book Your FREE Strategy Session With Our Team Today!

We'll help you map out a plan to fix the problems in your trading and get you to the next level. Answer a few questions on our application and then choose a time that works for you.


In today's video, we will show you how to build a breakout strategy on hourly bars, applied to the Gold future (as quoted on CME).

This strategy trades both short and long positions. It opens the trades only during specific time windows and only when there's a breakout of the last few bars, which serves as a confirmation of the entries.

While the backtest results of this script are very good, you’ll be challenged to put your own spin on the strategy.

Watch this video for a step-by-step breakdown on how to build a breakout bias strategy for Gold!

Enjoy! 😄


Hey everybody and welcome back!

One of the coaches of Unger Academy here, and today we’re going to be talking about how you can build a breakout strategy on hourly bars. 

What Is a Breakout Strategy on Hourly Bars?

Well, so here are the bars, and more precisely the candlesticks in this case, of the Gold market, namely the future on Gold quoted on CME. As you can see, we applied to this market a strategy that trades both long and short positions but in different hours of the day, taking advantage of the bias that characterizes this market.

And then the strategy waits for a breakout of an hour bar, because we are using a 60-minute timeframe, so each bar, each candlestick in this case, identifies a period of one hour.

There will also be a very narrow price channel on this hourly timeframe, so we'll wait for a very close confirmation, a breakout in the last 1 to 5 bars.

The Strategy's Script

In this case, I've already optimized the strategy. Let's go take a look at it now. 

So let's go through it together to see how it works. So, the inputs of the strategy are set at the beginning. I used the session end time (namely, 5pm New York time on the Gold market) to calculate a counter that will simply count the bars starting from the start of each new session.

So, at 5pm, which is the last bar of the previous session, the counter will have an initial value of 1, and then, each time a new bar is created, the value of the counter will increase by 1. Then the counter will always reset itself at 5pm, namely at the end of every session.

A stop loss was also set at $1,700. And then there are some other inputs: "long entry start bar", "short entry start bar", "long entry duration", and "short entry duration".

These inputs help us to identify the time window in which we will look for the breakouts on hourly bars. You can see that here, in the entry conditions, the bar counter must be greater than the bar we set as the initial input, and less than the duration, which will identify the hours of the day when the strategy can work.

As you can see, we’ll make long entries starting from the eighteenth bar up to 4 hours. So the system will place the orders from the eighteenth bar to the twenty-second bar.

While on the short side, we’ll enter at the ninth bar and will be able to enter for a maximum of three hours, which means from the ninth bar to the twelfth bar.

I then inserted two variables, which are "HH" and "LL", which are "Highest high" and “Lowest low" using the functions of MultiCharts "HighestFC" and "LowestFC", where "FC" stands for "fast calculation”, but you probably already knew that.

Then, we're going to optimize - and as I told you, I've already done it - the periods of this channel to figure out up to how many bars back to go to find the breakouts.

In this case I have used 1. So, we’ll buy if the high of this bar breaks the high of the previous bar and if we are inside our time window.

On the short side, we used a longer period because the futures are American and most of the trades take place during the European afternoon or evening, while not that much happens on these markets at night, so we need a more important breakout: not only the previous bar but maybe rather the lowest low of the last 3 bars.

Now for the exit conditions of the strategy. At one in the morning - exchange time again - we'll sell closing the long positions. While at 9am, we’ll close the short positions.

In the last line, we can see the conditions of the stop loss, which as I told you is set at $1,700.

Backtest Results

Now let's look at the results of the strategy. As I told, the strategy has already been optimized but, since you know all the inputs, you can also play with it and develop it in a slightly different way.

Here's the report of this strategy, which is very nice. Look, the equity line is really very good. Yeah, in the first part of the backtest, mainly in the years from 2010 to 2014, we do see that the performance of this system was very high indeed, whereas in the last few years it has gradually decreased, and you can see it from this chart. The slope of the equity curve is somewhat less positive than before.

The average trade of the strategy right now is only $52 because of the clearly huge number of trades involved. We're simple exploiting this bias through a confirmation using hourly bars but nothing more than that. So, for example, we could add some filters, such as the patterns, or market conditions to help this strategy perform better.

Let's also look at the annual period analysis, that is to say the year-by-year results. Let's look at the graphical representation of the returns and drawdowns. As you can see, in the first part of the backtest, the results were much higher, probably it was a pretty isolated case. And then after 2014, there are positive years but certainly with less gains compared to previous years.

This doesn't mean that the idea is broken or that it can't be used, but simply that in recent years, this market has probably been less volatile compared to the years 2010-2014. This means that strategies of this type are affected because obviously, there's a decrease in the average trade and in the potential gain from each new position.

Final Thoughts

Of course, this strategy can be improved. Right now, the weakness is caused by the average trade, which is too low to be used in live trading on this market. Remember that a single tick on Gold is worth 10$, so here we'll have only 5 ticks of average trade. But it will be possible to increase the average trade of this strategy by adding some filters.

I leave to you this challenging task hoping to have simplified your life. And I really hope that this video has helped you, at least to get started.

Please leave us your feedback in the comments below.

Below you'll also find a link to a completely free webinar by the 4-time world trading champion Andrea Unger, who will explain step-by-step how to approach systematic trading.

Thank you so much for watching. Will see you soon! Bye-bye!



Need More Help? Book Your FREE Strategy Session With Our Team Today!

We’ll help you map out a plan to fix the problems in your trading and get you to the next level. Answer a few questions on our application and then choose a time that works for you.


Andrea Unger

Andrea Unger here and I help retail traders to improve their trading, scientifically. I went from being a cog in the machine in a multinational company to the only 4-Time World Trading Champion in a little more than 10 years.

I've been a professional trader since 2001 and in 2008 I became World Champion using just 4 automated trading systems. 

In 2015 I founded Unger Academy, where I teach my method of developing effecting trading strategies: a scientific, replicable and universal method, based on numbers and statistics, not hunches, which led me and my students to become Champions again and again.

Now I'm here to help you learn how to develop your own strategies, autonomously. This channel will help you improve your trading, know the markets better, and apply the scientific method to financial markets.

Becoming a trader is harder than you think, but if you have passion, will, and sufficient capital, you'll learn how to code and develop effective strategies, manage risk, and diversify a portfolio of trading systems to greatly improve your chances of becoming successful.