How to Create a Simple Trading System to Beat the S&P 500

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 >>

Sometimes the simplest ideas are also the most effective....

You don't need super complex indicators or dozens of conditions to take advantage of market fluctuations. All you need is a simple idea and some common sense!

In this video we'll show you how to create a strategy for the S&P 500 future that can produce a great equity line despite its simplicity. 

By watching the video you’ll learn:

- The rules on which the strategy is based 

- How to code it from scratch using EasyLanguage or PowerLanguage (with open code system)

- What performance you could obtain with this strategy

Don't miss it! Enjoy the video! 😎

Transcription

Hey everyone and welcome back! One of the coaches at Unger Academy here and this equity line you see in this moment is the result of a trading system on the Mini S&P 500 future which we developed starting from a very simple starter script. We also applied some even banal exit rules and as you can see, we have excellent results both in terms of stability and profitability.

Now in this video we’re going to be talking about how effective it is to trade with simple ideas. It isn't necessary to experiment with complex indicators or indicators of indicators and so on. What we really need to do is to understand the nature of a market and to figure out how to make the most of its special features in a simple way.

But let's start from scratch and begin creating our trading system. Let's start from the basics, the "core" of the system.

As you can see, we’re starting from an empty code, as always. So the first condition we're going to write is the following one: if there's a cross between the close of the bar and the low of the previous session, then we'll buy the next bar at market.

Vice versa, if the close crosses below the high of the previous session, then we're going to sell the next bar at market. So let's try to compile this code and see what we get.

The equity line we get is already quite interesting, especially if we consider that we obtained it with just two lines of code. It goes up and has a fairly good average trade of $105.

The number of trades is 1655, which is pretty high. So what's the problem with this strategy? The problem is that it trades 100% of the time. Indeed, we never give this system a chance to exit, except when we give an order to reverse the trade. So, we'll either be long or we'll be short. If you look at the chart, you can see that there are no conditions where we are flat.

As always, of course, what could we set as our first exit? We could set a profit target and a stop loss, maybe $3,000 and $1,000, respectively, which are pretty reasonable values for the Mini S&P 500 future.

So let's compile the strategy and see what the effects are and how the trades made by the strategy change.

Now, I'd like to focus specifically on this case, where we have three long entries that are all based on the same condition. You can see that we have a price drop. Then if a candlestick is formed, and it returns to levels above the low of the previous session, namely this level, after this bar the strategy enters long at the next bar.

The same thing happened here. As you can see, the close is near the low of the previous session. The next close is above it. We go long and again we hit the stop.

An idea that could come from looking at this type of setup would be to limit the number of trades per session to one. To do this, we can simply use a condition based on the market position.

Indeed, if we find ourselves at the last session bar, then we'll say that "condition1", which will be our condition to enable entries, is equal to "true".

Otherwise, if the market position changes and becomes different than zero, which means that we are either long or short, then "condition1" will be equal to "false".

So let's add this condition before the trading orders. So let's write: "if condition1 then begin". These are our two conditions inside the IF construct, which will only be executed if condition1 is true. At the end of this group of conditions we'll put the keyword "END".

And in that way, if we go and compile the system, we’ll obtain.... Here we have, as you've seen, only one entry per session. So only one entry here, only one entry here, and so on.

Another thing that I want to point out is another little catch that could happen, namely that of entering right at the beginning of the session.

You can see that here apparently there is no cross but we still enter at the second bar of the session. This is because to have a cross we need two bars and therefore we must somehow give the possibility to trade, to enter the market, only if we're at least two bars away from the end of the previous session.

It's a good idea to use time conditions that straddle the session by about a couple of hours. A little bit like saying "let the market start, let's leave it a couple of hours to take its direction", and then we'll start trading.

We'll do the same by stopping 2 hours before the end of the session. But how can we tell MultiCharts to trade only when straddling a certain trading time window?

With regard to this market, which opens trading at 5:00 p.m. (so the first bar closes at 5:30 p.m.) and then closes at 4:00 p.m., we could simply say "IF time is greater or equal to 1900)", namely 5 pm plus 2 hours, "OR t is less than 1400", in other words if we are between 7 pm of this day and 2 pm of the next day, then we'll trade.

Let's go compile our script and see what we get. We'll see that these nasty entries no longer appear at the beginning of the session. And what do we get? In the end we'll get this equity line, which is exactly the same that we started with.

It's a very good equity line and we also have a large average trade that lets us cover all the operating costs related to this system, so both slippage and commission costs.

So as you can see, the ideas behind it are very simple. Finally we could add another condition and set a temporal exit. Why am I suggesting this kind of exit?

Well because if the market doesn't make any decision and we don't reach either the stop loss or the profit target, then it might be convenient to add an additional condition, where we say that if the bar count since we entered the market is greater than 230...

Because remember that a session is 23 hours long and therefore 23 hours multiplied by 30-minute bars is equal to 46 bars per session. And 46 times 5 is equal to 230.

So here we're simply saying that if 5 sessions have passed (which corresponds to a trading week) since we entered the market, then exit the position because the cross based on the high or the low of 5 days ago may no longer be valid.

So, we'd better exit the trades. So let's go and add this condition as well. You'll see that we have a slight change in the average trade but really nothing else. We're obviously making more trades now but we have enhanced the equity line.

You see that this part has been declining since the beginning of the year, so since late 2021 - early 2022. Given the current situation, the strategy isn't performing well, but the same goes for the index as well.

Consider that in this period the future is significantly larger than it was in 2008, so here we could also introduce some position sizing rules to be able to compare the strategy in this period with this other period.

Right now I've nothing else to add. I believe that this started script can be a good starting point from which you can go ahead in the development of this system, perhaps by adding a filter based on volatility or directionality. In short, you can have some fun.

What I do want to tell you, however, is to operate in a simple way, using simple ideas that, I guarantee, always turn out to be the most solid and performing in the long run.

Okay so if there is someone among you who is interested in the world of systematic trading, we're going to leave a link in the description of this video from which you can access a video of Andrea Unger, or get our best-selling book covering only the shipping costs, or even book a free call with a member of our team.

If you liked the video, please leave us a Like. Subscribe to our channel and click on the notification bell so that you can stay updated on the release of all our new videos.

And with that, we will see you in our next video. Bye-bye everyone!

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

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.