Stop Loss & Take Profit: How to Set them Properly and Avoid Issues in Live Trading

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

Stop loss and take profit are two widely used exit orders in systematic trading. Take profit allows us to close a profitable position by preventing profits from being "taken back”, while stop loss allows us to close a losing position by preventing excessive losses.

Due to its capital protection function, a stop loss is undoubtedly more helpful for risk management than a take profit, which is why it’s generally recommended always to include it in your strategies. Of course, the usefulness and effectiveness of these orders depend on their proper use. Setting them incorrectly can cause live trading problems and compromise their protective function.

To help you make the best use of them, we’ve decided to create a simple, comprehensive, and detailed guide.
By watching the video, you'll discover the following:
-What stop loss and take profit orders are, and how they work
-Where you should place the order levels relative to the entry price (for long and short positions)
-Different calculation modes, such as monetary amount, point distance from the entry price, and ATR (and the differences between these modes)
-Tips on how to avoid problems in live trading
-Sample codes & tests

Get ready to take notes and... Enjoy! 😎

Transcription

Introduction

Hey everyone, welcome to this brand-new video! Today we're going to be looking at what stop loss and take profit are and how best to use them.

These are orders to exit positions, meaning one exit occurs when there’s a loss, and the other exit occurs when there’s a profit.

We’ll discuss them in depth to understand how to use them and of course protect yourself from the pitfalls of live trading.

Okay, so stop loss and take profit, as mentioned earlier, are strategies to exit positions.

In this image, in this sort of "matrix," we divided them between the long side and the short side.

As far as the long side is concerned, the stop loss is placed below the entry level.

While, on the other hand, for the short side, the stop loss level will be above the level of the short order.

On the other hand, of course, it will be the other way around for the take profit. As Imentioned earlier, the take profit represents a profit exit. So, if we're buyers and we bought at this level, for example, then our take profit level must be placed at a higher level than our entry level.

Conversely, our entry level on the short side will be higher than our take profit level. Because the moment the market goes down, our purpose is obviously to make a profit. Of course.

So, as I mentioned earlier, if the market moves and it reaches the stop loss or the take profit, our positions will be closed.

These types of market exit orders aren't always used in trading strategies.

And about this, it would be better to specify that the stop loss should always be used to avoid losses that are too high or otherwise excessive compared to what we expected.

On the other hand, the take profit is certainly a parameter that could also be omitted in the case that conditions aren't too complex, where for example we can close the positions after a certain number of days, a certain number of hours, or by simply reversing the position.

So, the stop loss is an essential exit that should always be used, while the take profit could be omitted in many strategies.

The stop loss and the take profit represent the maximum levels of losses and/or gains at which we'll close our positions.

Once these levels are touched, the position is closed. In the case of the stop loss, it closes in loss if the stop loss level is reached, while in the case of the take profit, it closes with a profit.

5 Types of Stop Loss and Take Profit

But let's move on and go to the PowerLanguage Editor, where I've coded five case studies of potential stop losses and take profits that can be used for live trading.

In the first case, the stop loss and take profit are calculated as a monetary amount.

In this case, you can see that we use the reserved words "setstoploss" and "setprofittarget," which are already present by default in MultiCharts and are very convenient to use because you only need to specify the money amount.

In the following case, we see that the two reserved words are called in the same way but with the difference that inside the parentheses, the money amount is calculated as a distance in points.

In this case, it’s 10 points for the stop loss because it's multiplied by the "BigPointValue", which is another reserved word that extrapolates the value of the one-point move of the underlying asset that we’re trading on from the Quote Manager.

What you do need to keep in mind in these case scenarios is that by using the "setstoploss" and "setprofittarget" reserved words, the stop loss calculation in live trading isn’t done on the theoretical entry price of the strategy, which would be the "correct" price, but on the price adjusted with slippage.

So, what will happen in live trading? When the market reaches our entry order, we'll enter at the current market price, but if we're slipped by 1 or 2 ticks, our stop loss will be calculated on the actual price that the market reached, which is the price at which the order was executed.

This means that in this case, the stop loss level will be closer than it is in the backtest, and the profit target level will be 1 or 2 ticks further away.

To avoid these situations, we can use the case scenarios 3 and 4, where we calculate the stop loss and the take profit levels by specifying a distance from the entry price, which would be the theoretical entry price of our strategy. This way, we won't run the risk of having different stop loss and profit target levels in live trading.

To do this, we only need to specify the distance. So in the case of the long positions, we will write, "sell next bar entryprice minus 10 stop," which means that we’ll sell with stop orders once the market reaches a distance of 10 points away from the entry price of our positions.

Of course, in the opposite situation, so on the short side, when the market position is -1, we'll write, "buy to cover" because to close a short position, of course, we'll have to buy, again, at a certain distance from the entry price, which in this case is 10 points higher than the entry price.

Because as we've already seen before, the stop loss must be placed at a higher level than the entry price when we're short.

The take profit is set in the same way. Instead of stop orders, we'll use limit orders because, in this case, for the take profit, we'll place an order at a level that is more "convenient," you could say, than the current level.

So, the moment we're long, we'll obviously want to sell at a profit, that is to say at a higher price than our entry price, and so we’ll place a limit order at the entry price level plus 20 points.

On the short side, on the other hand, we’re going to do the opposite. So we're going to buy at the next bar, with a limit order, at the entry price level minus 20 points, because in this case, the market has to go down for us to make a profit.

However, it's good to keep in mind that these two cases, which are calculated on the entry price, contain a fundamental condition, which is the market position.

And for MultiCharts to calculate the market position, it needs to see exactly one entry of the strategy. So it’s only at the next bar after the entry bar that we can place our orders, for example, at the entry price minus 10 or at the entry price plus 20.

So, that means that for one bar, for those 5 or 15 minutes, and this depends, of course, on the time frame that you are using, with this type you won't have the right stop loss.

So be careful and use these two types only in fast time frames.

The last case I want to present is, let's say, using the Average True Range, which we know is an indicator that calculates the volatility in points of a particular underlying asset.

So, we can use this indicator, which, as I said, shows exactly a range in points.

Let's take a look at an example. In this case, the stop loss is set to the Average True Range, which is then a range in points, say, 5. So let's say that in that moment, the Average True Range is worth 5.

This 5 will be multiplied by the Big Point Value and then multiplied again by a multiplier, which is a number that is used to set our stop loss at one, two, or three times the Average True Range we’ve calculated.

The take profit works the same way, but for the fact that obviously, in this case, the multiplier is signaled using a different input.

For example, if the stop loss were set at twice the Average True Range, the take profit could be set at 4 times or 5 times the Average True Range.

A Script to Choose the Stop Loss and Take Profit

Now here, we can also see the last slide where we've grouped all the different types of exits. You can see that the "exit type" ranges from 1 to 5.

On the other hand, if we use zero as input, the strategy will work without both the stop loss and the profit exit.

And then, as you can see, I’ve just put two lines here at the beginning of the strategy so that you can buy this position and then sell it. Don't rely on this strategy, of course. It's just an example that can help us better understand how the different types of exits with stop loss or take profit vary.

Finally, let's take a look at the last type I included, the one with the market orders.

This could be useful in those cases where the broker who has to send our orders to the market rejects those orders for some reason. A possible example could be that the price level at which we're trying to send the order is too far away from the current price.

In such a case it might make sense to use a simple trick, consisting in waiting for a Close below the entry price minus the distance in points for the long side and vice versa for the short side.

So, instead of sending a stop order we will wait for this condition to occur. Then, when it occurs, our order will be triggered and sent to the market at the next bar at the current market price.

Below, we also see the conditions for the take profit, which work in an opposite way to the conditions written above.

Optimization in Multi Charts

And now let's move to MultiCharts, where I've loaded the Mini SP 500 chart. As a stop loss, I decided to use the same money amount that corresponds to the distance in points, for example, $1,000 on the SP 500 - the Mini SP 500 future - corresponds to 20 points, so "MyDollarStop" will be equal to "MyStopInPoints," which are these two inputs.

Likewise, "MyDollarTarget," which is equal to $2,000, is nothing but 40 points because the Big Point Value on this market is precisely equal to $50.

So, at this point, I've also used 3 and 5 as multipliers for the Average True Range so that we have initial parameters that we can optimize with.

So, what are we going to do? We're just going to optimize our inputs on the exits to see if and how the results change, and we're going to try the 0 to 5 case scenarios.

Zero included because, with zero, we'll also see all the cases where we won’t have any stop loss or take profit.

Okay, so let's start the optimization, which is done quickly, and here it is. By sorting the results by the type of exit, we can see that these are the results we get in the "zero" case.

So, the Net profit and the Drawdown, and the Average trade. Not a good result, but as we said earlier, we shouldn’t stop here and evaluate the numbers of the strategy that we know isn't so good.

And then, the important thing to see is that types 1 and 2, the ones with the reserved words "setstoploss" and "setprofittarget", give identical results.

But why is that so? We explained it a little while ago. The results are practically identical when specifying the money amount and selecting the same amount but written as a distance in points. You can even see that they match 100%.

As for type 3, where the stop loss and the take profit are calculated from the entry price, we can see that the results change only slightly, perhaps only in a handful of trades.

The orders are sent to the next bar after the entry bar. So, in the case that the stop loss was taken in the same bar, it would be possible to have some differences here.

Instead, we have some differences in type number 4, and they’re noticeable in this case. Remember that type 4 is the case where the stop loss and the take profit levels are calculate using the Average True Range.

Last, let’s have a look at the type five, which is the one with market orders. Again, not much should change from the previous cases.

But we can see also in this case, once the stop loss level is reached, the position isn’t closed until the next bar. And why is that? Because since we're using market orders, we'll have to wait until the bar is closed, which in this case lasts 30 minutes because we're using a 30-minute timeframe, to finally close our position.

Guys, now you know everything you need to know about stop losses and take profits, how to use them in live trading, and the differences between the various types of exits.

If there’s anyone among you who's interested in the world of systematic trading, I recommend that you go and click on the link in the description.

From there, you can watch a free presentation by our founder, Andrea Unger, the only 4-time World trading champion in real-money trading. Or you can get our best-selling book, by just covering the shipping costs. Or why not, even book a free strategic consultation with a member of our team.

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

And with that, we look forward to seeing you next time! Bye-bye for now!

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.