Tricks to Limit the Number of Entries of Your Trading Systems - Examples & Code

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

When evaluating the efficiency of a trading system we have to take into account different aspects, one of which is linked to the costs incurred to open the trades. Indeed, we know that the more trades we make, the higher the costs for commissions (and slippage) will be.

For this reason, it can be useful to resort to solutions that allow us to limit the number of market entries made by a strategy during the same trading session. Not only that but limiting the entries can also be useful to avoid opening more positions after having hit a stop loss or a take profit.

In today's video, we’re going to show you some useful solutions to limit the number of entries in the same session:
-on markets with a session that takes place within the same calendar day, such as the Dax and Bund
-on markets with a session that straddles two days, such as the S&P 500

All with codes and examples directly on the trading platform!

Enjoy the video! 😎

Transcription

Introduction

Hey everyone! One of the coaches at Unger Academy here and today we’re going to be talking about how to limit the number of entries in the same session.

Many of our students often ask us how to avoid making multiple entries within the same session. And this is generally because they want to avoid re-entering the market after a stop or take profit has already been reached. So, today together we'll see some alternatives.

The EntriesToday Function

Okay, so the first solution for us systematic traders is MultiCharts' prebuilt function called "Entries Today". It calculates how many entries have occurred during a given date, which will then be the input for the function.

It can count a maximum of 10 entries by default on the same date, which would already be a lot, but if you wish, you can also increase this value, making this FOR cycle last longer, creating a longer iteration by changing this number.

The Basic Strategy

So, for example, if we wanted to use this function in a strategy, we would only need to recall it. All we need to do is enter the current date in the parentheses as an input, which we'll enter as (d), so just one letter. It's really very simple.

And then as a condition, I've used equal zero in this case, which means that today's entries, on the calendar day, must be less than zero. So, to be able to open long or short positions the strategy shouldn't have made any trade today.

As you can see, I've created this strategy. In case 1, namely with the active multiple entries set to 1, there are no conditions. The strategy can enter whenever it wants.

In this case, we'll work on the S&P 500 but it's only to give an example, with breakout entries seen on the high and low of the current session, with stop orders.

This type of strategy would make this number of trades. At the end of the day, we'll close the positions. But as mentioned before, this is just a test to try and understand what this MultiCharts function actually does.

With no conditions set on the entries in the same session, you can see that the strategy is free to enter and exit several times during the same day without any constraints.

You see: buy, short, buy, short. So, there is an alternation of trades even inside the same session, which is actually something that, if you think about it, wouldn't make much sense.

Because it would mean that... Well take a look at this day here: the market has opened. We've bought. Let's look at the exact time. Here, for example, the strategy bought at 6:35 pm exchange time. After that at 9:30 pm, so after 3 hours, it reversed position. Then after another 3 hours it changed its position again and so on. So it eventually made 1, 2, 3, 4 entries during the same session.

Clearly one has to think that the more entries we make... Trading is not a zero-sum game. Every position that is given to us costs money and that's why we must also try to make a strategy efficient from a certain viewpoint, without forgetting the statistical sample, which is very important.

Strategy with 1 entry/day

So, let's go back to the script and you'll see that I've inserted two types of conditions. The first condition is calculated with today's entries, so we'd like to ensure that no entries have occurred on this single date, today's date.

By setting Multiple Entries, which is our input, equal to zero, we'll be able to see the entries that the strategy will make, which will be only one per day. So one per calendar day.

Now let's go back to the chart to see what's going on. Let's set "Multiple Entries", our input, equal to zero and there you go. Now the strategy will calculate the results and let's see how the strategy changes.

There you go, it finished. For example, in this session there's only one trade. In this other session there's a single trade.

But there is one case where we still see two different trades in one session. But we had told the function to avoid this. And, indeed, we see that in most cases this does happen, we only have one trade during the session.

But there are also some special cases, such as the S&P 500 and all the American markets in general, which have a session that starts on one date... here for example on 14 March 2022, the market opens at 5 pm and then closes the session on 15 March at 4 pm. This means that the S&P session is spread over two different calendar days, which creates problems for this function.

Because, as we said, the function will calculate the entries - only one entry - but from midnight to midnight. Not from the opening time of the session to the end time of the session.

Strategy with 1 entry/session

And you'll see that therefore in some particular cases the strategy might enter again. How can this be avoided?

All you have to do is create a variable that I've already created. As you can see, I've created two variables: "MP", which stands for market position, very simply. And then a true-false variable called "Ok Trade" which acts a bit like "Entries Today".

We'll tell it that at 4 p.m., which would be the last bar of the previous session, we'll reset our condition, which will be equal to "true". So, at each new session, there will be the possibility to place orders. But if the market position changes or if the market position is different from zero, then "Ok Trade" will become false.

So, by setting "Multiple Entries" equal to -1 and our variable, our condition, in this case "Ok Trade", we'll see that we're basically going to calculate the number of entries from the start of the session and not from midnight as "Entries Today" does.

In this case, indeed, if we go and change the input in our script, putting -1 in this case, at this point we should only see one and only one trade per session.

And that's it, you can actually see that the strategy now only makes one trade per session. So, what does this mean? The Entries Today function, which calculates the entries that occurred within a date, namely a calendar day from midnight to midnight, can be used without problems on most European instruments, such as the Dax or the Bund, which have a session that falls on the same calendar day.

As for the American futures, on the other hand, things are different. These markets have a session that straddles two days and consequently it's necessary to find, as I showed you earlier, an expedient to be able to limit the entries to only one per session.

Well, if there is anyone among you interested in the world of systematic trading, I'd suggest you click on the link in the description of this video. From there you can watch a video of Andrea Unger or get our best-selling book covering only the shipping costs. Or 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 to stay updated on the release of all our new videos.

Thanks so much for watching. I will 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

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.