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.BOOK YOUR FREE STRATEGY SESSION NOW >>
Today we talk about round numbers and how to use them to build effective trading systems.
In trading, "round numbers" represent rounded price thresholds that correspond to sensitive levels, such as supports or resistances, or in any case levels that could indicate market turning points.
This video explains how to create trading systems that can effectively exploit round numbers to generate entry signals.
By watching the video, you'll learn:
- How to code round numbers in MultiCharts and in TradeStation.
- How to optimize the step for rounding the price levels.
- The results you can get by applying a system based on round numbers to the S&P 500, the Crude Oil Future and the Gold Future.
One of the coaches of Unger Academy here, and welcome to this brand new video. Today we're going to keep on exploring the different opportunities that automated trading offers, and more in particular, we're going to focus on round numbers and how to use them to build effective trading systems.
Alright, so let's start by saying that in the financial markets, round numbers represent some psychological thresholds that tend to trigger a sort of automated mechanism in traders when they are about to send orders to the market.
For example, if the price of an instrument is 1,452, for convenience's sake, a trader may decide to send the relative order at a round price, such as 1,450, 1,440, or 1,445.
In short, he may decide to pick a more or less recurring threshold for identifying the entry signals. For example, here we have the chart of the S&P 500.
As you can see, we plotted a bundle of horizontal lines in steps of 50 points. So there'll be one line at 4,700, then one at 4,650, then one at 4,600, and so on. These levels should be significant and potentially represent market turning points. Later on, we'll also show you a strategy for this market but now, let's just make another graphic example of how we decided to represent the different thresholds. In practice, at the beginning of each session, the system saves two variables - one above and one below the session's opening price - and that creates a neighborhood.
In this case, the system works in steps of 50 points. As you can see here, the indicator has set the levels at 4,750 and 4,700 points, and when the prices break through these levels, it generates the entry signals.
Of course, we can also optimize and adjust these thresholds according to the step we prefer to use.
How to create a round number indicator
But now, let's just take a look at the code of this indicator so that we can better understand how to develop this kind of idea.
As is often the case when we develop our systems in PowerLanguage, much of the work is done by the language itself. Actually, this language was specifically designed to make things easier for automated traders. So there are some reserved words that can help us and speed up the calculation process of the indicator itself.
But let's go in order. In the first two lines of the script, we define the inputs and variables used in our trading system. In this case, we have the "Step" input, which is the threshold on which to calculate the levels, and then we have two variables corresponding to the levels calculated using the step formula.
Keeping on reading the script, we see that at 4 pm... But why at 4 pm? Because 4 pm is the closing time of the S&P 500, which is the market to which we are going to apply this system. In this way, we’ll work with fixed levels, and more in detail, we'll only have two levels each day, and these levels are calculated again at the beginning of each session.
To calculate these levels, the system takes the step value and multiplies it by the integer obtained by dividing the close of the last session by the step value. For example, if the current close is equal to 2,467 and we wanted to find a neighborhood of 50 points under this close, then we'd just need to multiply 50, which is our step, by the integer obtained by dividing the current close (which is 2,467) by the step, so 50.
In this way, we get 2,450, which is the round number below 2,467 that I was just looking for.
At this point, calculating the rounded upper level is very easy. We only need to take the lower level (so "LevDn") and add it to the step itself. In this way, we can identify the higher rounded level by rounding the current close up to the closest 50-point threshold.
How to create a strategy on round numbers
At this point, we went ahead with our analysis. So we created a strategy by optimizing parameters such as the step we've just seen, the stop loss, or the profit target, for example, as well as the maximum number of days for the positions to be open.
As mentioned, this strategy works on the S&P 500. We set TradeStation's 15-minutes continuous contract as "data1" and a custom future as "data2". Please pay special attention at this point: this custom future doesn't consider the rollovers that happened in the past. This means that the expiration gaps are still present because the data we are using were not back-adjusted by TradeStation or any other data provider.
This is because in the year 2008 if we wanted to use this strategy, we would have used the prices of the future when it expired at that time and not the adjusted prices we see today.
Let's take an example to better understand what I'm talking about. In this case, we have the S&P 500 at 1440 minutes as "data1" and, immediately below it, the custom future whose data were not back-adjusted based on the rollovers. Then, in the lower chart, we see the difference between these two underlyings. Of course, they're basically the same thing, but as a matter of fact, they are calculated in a different way, especially for the past.
Take this level. We are in 2008, and this was the close of the custom future. It was about 1,300 points. If we look at the same close of S&P 500, so on the same level, we find a close of $1,060.
This effect is also known as the "contango effect" and refers to a tendency that characterizes the market under normal circumstances according to which the price of futures is higher than that of the underlying when the future expires.
So please keep in mind that if you want to develop this kind of strategy, you need to use the data of non-back-adjusted custom futures because using back-adjusted data would mean testing your strategy on fictitious prices.
So let's see the strategy together. It's very simple. I have already optimized the "Step" input and got the best results using 50.
As usual, we start by declaring our variables. As you can see, I added a variable called "DayInTrade" that will be used to calculate the maximum number of days for the positions to be kept open. I set a maximum of 3 days.
Then we used two variables, "okay long" and "okay short", to limit the number of entries on the same day. And then there are the two rounded levels, "LevDn" and "LevUp", and we use them to trigger our strategy.
After that, we added a stop loss and a profit target.
The system works both long and short in steps of 50 points, so essentially, it is a breakout system.
And here, on these two lines, so on lines 21 and 22, we see the entry conditions of the strategy. So we'll look for a continuation of the trend and go short on the lower level and long on the higher level.
As for exits, if positions don't hit the stop loss or the profit target, at the latest, they will be closed at the end of the second day in the position, so three days at most.
Let's now check out the results produced by this strategy. As you can see, the system obviously performs very well, especially in the last part of our backtest, when it seems to have accelerated considerably. Perhaps this is due to the increase in volatility in the last period, which made the market touch 50-point levels more often than usual, generating more entry signals and, of course, more profits, as we can see from the annual report.
The strategy also did just fine in 2008, the year of the subprime mortgage crisis, and more in general, throughout the entire historical period considered in our backtest.
The year 2017 is the only one in loss, and as some of you may remember, volatility levels were very low.
In that year, we see that the system made a very small number of trades compared to other years. Then, as we've already mentioned, in the most recent years there has been a surge in profits as well as in the number of the trades, which is also due to the fact that the value of this future has increased over time. So, as a consequence, touching and breaking through 50-point step thresholds has become easier.
Both sides seem to work fine. For sure, a strategy that makes so many short trades on this underlying could be a problem. For this very reason, one may consider the possibility of further refining it, but I leave it to you to try and explore it a little more to see if, with different conditions for the long side and the short side, we can find some better solutions.
Anyway, the short side seems to perform quite well, especially when the market drops sharply. So think about it carefully before you get rid of the short side entirely from a system like this.
Other strategies on round numbers
Then I've also developed this basic idea for other markets, optimizing the various inputs according to the characteristics of the different underlyings.
For example, here we have two strategies, one for the Gold future and another for the Crude Oil future. They date back to a few years ago when we developed them to exploit round numbers in our systems.
Today, after a few years, both have resisted the impact of the out-of-sample, continuing to perform well and confirming that some markets may actually react or continue their trend close to round levels.
Here you can see the strategy for Crude Oil. This is an intraday system that can be used and backtested using the non-back-adjusted custom future. Since the positions are closed at the end of the day, any fictitious gaps due to the non-adjustment of the data wouldn't affect the backtest results.
In the case of the strategy for Gold, instead, we couldn't do that because this is a multiday strategy, so using data that contains fictitious interruptions would produce totally unreliable backtest results.
The strategy for Gold enters in steps of $50, like that of the S&P 500 we’ve just seen, whereas the one for Crude Oil enters in steps of $5.
Let's just go and take a look at the equity lines and the results of these two strategies. Let's start with the system for Gold, which, as you can see, has worked pretty well in recent years. This is the equity line of the system since 2008.
And in this case, too, the annual period analysis, so the annual results of the strategy, are very positive. I developed this system in 2019, and as you can see, the year 2020 was a very volatile year that allowed the strategy to make many entries and, fortunately, also to reach some really huge profits.
Let's also take a look at the other strategy, the one for Crude Oil. It is quite similar to the previous one except for the fact that this is an intraday strategy and not a multiday one. However, it also did just fine. We haven't seen extreme volatility levels on this market yet, if not for a few months in 2020.
However, the Crude Oil market has also lost a lot of value over the years, although we've seen a strong rally of the energy markets over the last few months. But generally, the value of these underlyings has decreased over the last 10-12 years, and consequently, the number of trades has also been lower in recent years.
Nevertheless, the strategy has produced great results. This is the equity line of the system, and you see that it's been fairly regular even in recent years. There's a bit of drawdown in the last period, but I'm confident that the strategy will recover.
Alright, guys, with that the video is over. I really hope that you liked it!
And if you want to learn more about the method of the 4-time world trading champion Andrea Unger, please go and check out the description of this video because I'm going to leave you a link to a free webinar with all the information that you need to start creating your own portfolio of trading systems.
With that goodbye, everyone. Stay safe. I'll see you next time. 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.BOOK YOUR FREE STRATEGY SESSION NOW >>
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.