The Best Stop Loss Strategy (Backtested)
638 views
Dec 11, 2024
Learn what a stop loss is and where to optimally place your stop loss. I backtest using ten years of data on the SPY, Sector ETFs, and S&P500 constituents to determine best stop loss placement. ✉️ Learn the secrets of legendary traders and investors: https://bit.ly/4aCna7i 🔗 Follow along: https://analyzingalpha.com/blog/stop-loss-for-stocks 0:00 Introduction 0:37 What is a stop loss? 0:57 How does a stop loss order work? 1:45 Stop loss benefits & drawbacks 2:34 Stop losses to protect profits 3:58 Backtest results 4:20 S&P 500 results 6:12 Sector stop loss results 6:41 Equity stop loss results 7:10 Equity atr stop loss results 7:23 Backtest summary 9:43 Optimal stop loss
View Video Transcript
0:00
hey there leo here have you ever
0:02
wondered what the best stop-loss is to
0:03
use while trading well today you're
0:05
going to find out and like everything on
0:08
analyzing alpha it's going to be backed
0:09
by data so what are we going to talk
0:11
about today well first we're going to
0:13
cover what a stop loss is obviously
0:15
newer traders need to know that then
0:16
we're going to talk about how traders
0:18
use stop losses and trailing stop losses
0:20
then we're going to talk about the back
0:22
test first we back test it on the spy or
0:24
the the index itself then the sector
0:27
etfs and then equities as a whole and
0:29
finally we're going to come to the
0:31
conclusion that you're probably waiting
0:33
for what's the best stop loss to use if
0:35
you're an experienced trader that
0:36
doesn't care to learn about stop losses
0:38
you can skip to minute four for the back
0:40
test results i hope you're excited i am
0:42
let's get rolling so what is a stop loss
0:45
a stop loss order protects profit or
0:47
limits risk on an investor's open
0:49
position by exiting at a predetermined
0:51
price now for those of you that might
0:53
criticize that definition obviously i
0:56
understand that risk you know can be
0:58
quantified in many different ways but
1:01
i'm trying to keep things simple for
1:02
this explanation so how does a stop-loss
1:05
order work well after a trader opens a
1:07
long or short position by placing an
1:09
order with a broker they'll often place
1:11
a follow-up stop loss order that will
1:14
limit the amount of money that they can
1:15
lose on the investment if it moves
1:17
against them now this order stays open
1:20
until it reaches the stock price and at
1:22
that point it executes and because it
1:24
executes as a market order there's no
1:26
guarantee that the order will execute at
1:28
the stop price due to slippage and
1:30
typically if the stops are placed at
1:32
obvious points or there's unexpected
1:35
news the price can actually dramatically
1:37
differ from the stock price now a stop
1:40
limit order which executes as a limit
1:42
instead of a market order can help
1:44
alleviate this problem with one
1:45
significant risk the order may never
1:47
execute if the price isn't hit causing
1:49
substantial losses so what are some of
1:51
the benefits and drawbacks of using a
1:53
stop loss well stop losses provide us
1:56
with many benefits and one big drawback
1:58
automatic execution enables us as
2:01
traders to limit our losses to a
2:02
predefined level obviously slippage and
2:05
overnight moves aside and this prevents
2:07
loss aversion so placing a stop-loss
2:09
order in advance with a broker also
2:11
enables us to step away from monitoring
2:13
the markets and maybe even enjoy life
2:16
even though i know how much we all
2:17
secretly love trading now a stop-loss
2:20
has one primary risk and this is
2:22
volatility causing you to hit your
2:24
stop-loss too frequently and this will
2:25
erode your capital due to fees and
2:27
slippage
2:28
and even though we've been talking about
2:30
stop losses primarily in the context of
2:32
conserving our capital there's also
2:34
another way to use stop losses and that
2:37
is to protect gains
2:39
there are multiple ways to protect
2:41
profits using stop losses but for now
2:43
let's just concern ourselves with the
2:45
trailing stop loss and the reason for
2:47
that is i'm trying to give newer traders
2:48
an understanding of all the options
2:50
available to them so what is a trailing
2:52
stop loss well it's in the name a
2:54
trailing stop loss simply is just like a
2:57
stop-loss only it trails the price and
2:59
this is best seen using an example so
3:01
let's pretend we purchase a stock at a
3:03
hundred dollars and we set a stop loss
3:05
of five percent which would be ninety
3:07
five so right there's five dollars
3:09
because five percent of a hundred is
3:11
five dollars which you know hundred
3:13
minus five is ninety five now let's
3:15
pretend that the very next day the stock
3:18
moves to 120 well the stop is going to
3:21
follow that the stop it would still be
3:23
95 of 120 which would be 114
3:27
right and then let's pretend the very
3:29
next day the price comes back down and
3:31
hits the stop price of 114 and there's a
3:34
dollar of slippage that means that our
3:36
stock would have sold at 113 so what
3:39
happened there so we purchased a stock
3:41
for a hundred dollars it moved up and
3:43
then it came back down hit our stop and
3:45
we made 13 and guess how many times we
3:48
had to update that stop loss zero right
3:50
because it's automatic and it follows
3:52
the price
3:53
and now it's the time you've been
3:55
patiently waiting for or maybe not so
3:56
patiently if you went ahead and skipped
3:58
right to this section
4:00
but we're going to go ahead and review
4:01
those back tests we start in 2010 and we
4:05
run the back test for a 10-year period
4:07
we'll first cover the s p 500 then the
4:10
sector etfs and then stocks and we'll
4:13
notice that
4:14
well i don't want to spoil the surprise
4:16
let's go ahead and check out the s p 500
4:19
back test
4:20
behind me you'll see a graph from
4:22
backtrader which is a popular python
4:24
back testing library if you're
4:26
interested in data science artificial
4:28
intelligence algorithmic trading or back
4:30
testing you can check out my other
4:31
channel here if you're not a coder and
4:33
just want the results don't worry i've
4:35
got you covered now this graph is broken
4:37
into four sections the top section is
4:40
the portfolio section where we can see
4:41
the total value of our portfolio in blue
4:44
and the value of cash in red and we can
4:47
see that that value of cash vacillates
4:49
between 100 invested and 100 in cash
4:52
depending upon if our stop loss is hit
4:54
and if it is hit we then go ahead and
4:56
reinvest next week
4:58
now the second section shows our
5:00
round-trip trades profitability we see
5:02
that the blue trades are profitable
5:04
trades the red trades are unprofitable
5:06
trades and depending upon how far they
5:08
are from the zero line shows the
5:10
magnitude of the profit or loss
5:12
the third section which is arguably the
5:14
most important shows our performance
5:16
against the benchmark our strategy's
5:18
return is in red and the benchmark
5:20
return of just buy and hold is in blue
5:23
and then finally the bottom section
5:25
you'll see the s p 500 with the blue
5:27
dots or the green dots showing
5:29
where we entered and the red dots
5:31
showing where we exited
5:33
at this point i'm going to step out of
5:35
the way so you can see the graphs in
5:36
their entirety as we review them but
5:38
don't worry my magical voice will be
5:40
with you every step of the way i think i
5:42
said step a few times there anyways
5:44
let's check them out i forgot to mention
5:46
that i ran a test for 5 10 15 20 25 and
5:49
30 stop loss levels i'm only going to
5:52
show you the five percent stop levels
5:53
but at the end of this video i'll show
5:55
you the data for everything but i think
5:58
the picture will become clear so as
6:00
we've already discussed the first graph
6:02
is the s p 500 index where our strategy
6:05
underperforms just buy and hold so again
6:08
the stop loss performs worse than just
6:10
holding the next section
6:12
i removed the graph of the s p 500 index
6:16
so it's a little more easier to see and
6:17
we can see that the sector stop loss
6:20
underperformed the buy and hold and we
6:23
can also then go to a trailing stop
6:26
and we'll see that that even
6:28
underperforms even more significantly
6:30
with you know the s p 500 index going up
6:32
2.2
6:35
and our buy and hold only returning uh
6:38
you know 1.03 and for equities it's much
6:41
of the same story we do seem that there
6:44
is some relative positive performance
6:46
but for the most part we underperform
6:49
and with a trailing stop loss that gets
6:51
much more significant so again
6:54
the stop loss strategies have not worked
6:56
so what about if we adjust these stop
6:59
losses to an average true range so that
7:01
way we're not just setting a single five
7:04
percent stop for every stock we're
7:05
actually adjusting it based on the
7:08
average range of that stock well the atr
7:11
stop loss actually performs worse than
7:14
the five percent stop loss and the
7:16
trailing stop loss is actually become
7:20
really terrible now this is the point
7:22
where it's going to show you the data
7:23
but i think the charts that we just went
7:25
over
7:25
that made the message crystal clear but
7:28
if you're interested in the data or the
7:29
code feel free to check out the link in
7:31
the description below where you can see
7:32
everything in its entirety so what did
7:34
we see well we saw that a buy and hold
7:36
strategy beats an arbitrary stop loss of
7:39
multiple levels at the s p 500 index
7:42
level at the etf level and even the
7:45
individual equity level and if we had a
7:47
trailing stop loss basically our
7:49
performance was even worse it was
7:51
miserable now let's take a step back and
7:53
think about why that is the case right
7:55
because in trading everything should
7:57
make sense whether it's a pattern
7:59
whether it's a strategy whatever it
8:01
should make sense and it always does if
8:03
you're on to the right thing so let's
8:05
step back and think about what the
8:07
market is from a trading perspective i
8:10
view the market as this beautifully
8:11
complex game where there's lots of
8:13
really smart participants trying to
8:15
figure out how to be better in fact just
8:17
people like you guys are researching
8:19
this now now if we could set a arbitrary
8:22
5 10 15 20 stop loss or trailing stop
8:25
loss and make money what's going to
8:26
happen well obviously that's going to
8:28
get arbitraged away because you guys are
8:30
going to find it we're going to start
8:31
using it and now it no longer works so
8:34
what is the answer to where you should
8:36
place your stop loss well
8:38
i'm not going to get into market
8:39
structure and why setups work or
8:41
different types of setups work and the
8:42
psychology behind them and things like
8:44
that and different places where stop
8:46
losses are and how they trigger and
8:47
that's why patterns work but blah blah
8:48
blah blah blah basically let's just
8:50
assume a breakout strategy works and
8:53
we've identified a breakout now if we if
8:56
we have a breakout where should the stop
8:58
loss be well it should be at the low
9:00
where it invalidates that breakout now
9:02
there's different areas to place it such
9:04
as the average
9:05
daily range or something like that but
9:07
basically the idea is if it comes back
9:10
down on you it wasn't a valid breakout
9:12
you misidentified that and you should
9:14
stop out now this obviously is different
9:16
for mean reversion trades where you know
9:19
you're essentially catching a falling
9:20
knife this stop loss if you even set one
9:23
is even different
9:24
and finally it also depends on the
9:26
market that you're using right the
9:28
crypto market is a lot more volatile and
9:30
you'll see that it has a lot more
9:31
flushes and
9:33
essentially reclaims
9:36
if you go and look at some of the crypto
9:37
bars you'll see massive drawdowns and
9:40
then they come right back up so the
9:41
stop-loss strategy has to be different
9:43
based on the market so there's your
9:45
answer now if anyone just says oh well
9:47
you should just automatically cut any
9:48
loss at five percent you should probably
9:50
be skeptical now knowing that that just
9:53
doesn't make sense but if someone does
9:55
come to you and says you know what this
9:57
is a market structure this is why it
9:58
works and here's the sound rationale
10:00
behind it then maybe you should listen
10:02
so like this video please hit the thumbs
10:04
up and maybe even subscribe it lets the
10:06
google algorithm know that this is a
10:08
video we're sharing and if you really
10:10
liked it let me know what else you would
10:12
like to see again i love back testing
10:14
and doing all sorts of nerdy stuff as
10:15
you can see on my other channel but the
10:17
goal is to help you guys understand what
10:20
is true in trading because there's so
10:22
much snake oil out there and hopefully
10:25
you know we can make some money together
10:27
i don't know if i can say that this is
10:29
for educational purposes only just so
10:31
you know okay have a wonderful day and
10:33
hopefully see in the next one bye-bye
#Business & Industrial
#Finance