How To Exploit Gold Future’s Recurring Patterns (with 2 lines of code)

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.


The Gold Future is one of the largest, most liquid, and most traded markets in the world.

In this video, we show you how to use two simple lines of code to confirm the presence of some intraday recurring behaviors (or biases) in this future and identify the best times of day to open and close long and short positions.

You'll also learn how to understand if some changes in behavior have occurred through the years so that you can adapt your approach to prevent your strategies from deteriorating.

An extremely useful video for everyone who wants to trade the Gold Future as well as for all those who want to learn a method to quickly confirm the presence of recurring behaviors and exploit them in their strategies.




Hey everyone! One of the coaches of Unger Academy here!

And today we're going to be delving deeper into the Gold future quoted on CME, and in particular, we're going to focus on its biases, that is, its recurring behaviors.

So the Gold Future quoted on CME is one of the most liquid and traded instruments in the commodity market. For example, investors often use it to cover their positions on the stock market.

It would be very interesting to be able to figure out if there are some recurring behaviors in every single session of this instrument.

The intraday Bias on the Gold Future

So how does the Gold Future behave during the day, on average? And more importantly, is there a way to exploit that behavior? We carried out some tests to figure that out and We found something extremely interesting that we want to share it with you.

This is the first chart that we wanted to show you. In it, you can see the average monetary excursion of the Gold Future throughout one day, so starting from midnight and ending at midnight the next day. The dotted line you can see at 6 pm corresponds to when the transactions open.

And here you can see that the chart is completely flat from 5 pm to 6 pm, nothing happens. This is because the transactions on this underlying are open only from 6 pm of one day to 5 pm of the next day, so no transactions will ever occur from 5 pm to 6 pm. So what you can see here is the average price movements of the Gold Future during the day starting from January 2008 to October 2021.

As you can see, the underlying generally starts from zero and then oscillates in this way. So, starting from what we see in this chart, we can now go and see what would happen if we sold this underlying at around 2 in the morning and then we bought it again at 10 in the morning, and then obviously we kept it until 2 am the next day.

The code and the strategy

To do that, we can open MultiCharts and write the following lines of code, which are really very simple: "if t=200" (which means "if it's two in the morning") "then sellshort next bar market" (which means that we'll go short on the underlying if it's two in the morning) and "if t=1000" (so if it's 10 in the morning) "then buy next bar market".

Let's compile the strategy and see what happens when we use these two lines of code... Oops, sorry... And let's see the results that these two lines of code would have produced on the Gold Future from 2008 until today.

So I compiled the strategy, and now let's see how it would have performed. You see, the average trade is quite large! And here's the equity line. Wow, guys it really seems that those two simple lines of code can perform pretty well.

However, if you look at the results after 2018, this is around mid-2018, the bias we're trying to exploit seems to have faded a little bit. But how can we make sure of that? Well, I've prepared another chart that shows the exact same thing that we've just seen with the only difference that this time, to the chart that I've shown you before I added another chart that shows the average monetary excursion of the Gold future since 2018, so from January 2018 to October 2021.

By comparing the two charts, we can see that the average trend seems to have changed quite a bit. There are still some recurring behaviors, such as the strong bearish trend from 5 am to just before 10 am.  And the bullish trend seems to continue, persisting from 10 in the morning till midnight. This long effect in the first two hours of the day seems to have faded a bit. However, it seems to be still valid from 10 am till midnight. So let's see if this is actually the case. We expect that the long trend hasn't been affected by this change while the short trend definitely has. And the reason for that is, if you remember, we went short here, so at two in the morning, and then we went long here. As you can see, here we're talking about minus 11 and minus 14 - these numbers are in dollars. And starting from the beginning of 2018 until today, we would have got an average trade of $3 on the short side.

So let's move on to the chart and see if actually... Yes, on the short side, it hasn't done anything more. This is the beginning of 2018, and after two years, we are at the same level, and we went down and then we went up again. On the other hand, on the long side, we can see that the trend continues to persist and is also going quite well.

I'd like to point out one last thing about these charts. Do you see this strong gap here? This is the average opening gap of the market. But how is it possible to have such a large gap on an instrument that's always open 23 hours a day? Why is it so strong? The reason is that this is not the weekly gap, so this isn't the gap that occurs between the Monday session and the Tuesday session, for example. But it's the over-weekend gap, so the gap that occurs between the close of the Friday session and the reopening of the market after the weekend.

So in this case, we may even have another bias, if we want to call it like that - a bias that tells us to buy every Friday and sell at the beginning of the next week because on average, we can expect an upward gap in that case. But let's save that for another video!


Now, going back to our intraday bias, what could we say about the conclusion? We can say that we've definitely found an edge, you know, an advantage in the market, but unfortunately, that edge cannot be fully exploited yet because the average trade is not large enough to cover the commissions and the trading costs. However, since we've been working with only two lines of code, there's still room for testing a stop loss, a take profit, and why not, also some filters.

To build solid trading systems based on existing market edges like this one, we've got a specific method that was developed by the 4-time world trading champion Andrea Unger. If you're interested in learning more about how this method works, and if you'd like to delve deeper into the world of systematic trading, you can find a link in the description of this video. It will take you to a completely free webinar that will introduce you to this very interesting world, which is so full of new opportunities.

And if you want to learn more about other topics or, why not, other markets, please let us know in the comments, and we'll talk about that in our next videos.

And that's it for today. Thank you so much for watching. And we'll see you on our next technical video.



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.