Trader Tech Talk 009: Ready, Set Stop!

In this episode, John discusses how to set your stop-loss using a variety of manual and automated techniques.

In this episode you will learn about:

  • A tool that will help you calculate your stop loss size based on risk
  • An indicator designed to set stop losses
  • How to use a trailing stop
  • Programmatically setting your stop-loss
  • Why you would want to set a stop-loss in the first place

Resources for this episode:

Transcript

When I first started really learning about trading, I learned strategies, and techniques and indicators, and it was all really interesting, but the question I kept asking myself was, “Ok, that’s nice, but where do I set my stops?”  and “Wow, awesome strategy.  Now, where do I put my stops?”  Not all books and courses are guilty of this, but it seemed that setting your stops was kind of an after-thought to the process.

My early losses in trading made me realize that stops were really important, and no matter how good the stock tip or recommendation, the price could go down.  Then what?

So, today we’re going to talk about 4 or 5 different ways we can use to set stop losses in our trading systems.  Some of the methods work well for manual trading, and some work better for automated trading.

First of all, just as a review or for new traders, what is a stop?  A stop, or stop-loss, is an automatic exit of your trade if it goes in the wrong direction.  So, for example, let’s say you are trading the Euro-dollar, and bought at 1.32.  If it goes up, great, you make money when you sell.  If it goes down, your stop loss is placed so that it automatically sells your trade at a loss at a pre-determined number.  The reason for a stop-loss is to make you take a small loss, so that you don’t end up with a bigger loss later.  Without a stop-loss, the Euro could keep going down until your account is wiped out.  You don’t want that, so you take losses in small increments, using the stop-loss.

So, with that out of the way, how do you know where to set your stop-loss? The simplest way to set your set your stop is just to pick a number of pips or points below your buy, or above your sell, and stick to it.  So, in our Euro example, we might put our stop-loss at 20 pips below the entry point.  If the price moves down 20 pips, it closes the trade at a 20-pip loss.  The advantage of this approach is that it’s really easy to do, and to be frank, a simple stop loss strategy is so much better than no stop loss at all.  Honestly, if I had learned about stop losses before I began trading, I’d be thousands of dollars richer at this point.

The disadvantage of the simple 20-pip stop loss is that it doesn’t really take into account how much you are trading.  For example, if you have placed a trade for a half a lot, a 20 pip loss is 1% of your account of $10,000. But if your trade size is 2 lots, that’s 4% of your account.  And a bigger lot size means you have more and more at risk.  So it’s clear that just picking a number of pips doesn’t really protect you from ruin, if you don’t take how large your trade size is.

Another commonly used technique to set stops is to use a price point on the chart, say a recent high, or a recent low, or a visual point on the chart below support or above resistance.  This is smart because it makes you pay attention to what is happening on the chart.  Instead of an arbitrary number, you set your stops so that if price breaks below support, you’re out.   But you’re still left with the question of how much risk is involved.  Even though you’re using visual support or resistance levels, you don’t really know if you are risking 1% or 5% of your account total in one trade.

So, a better approach might be to use a tool.  There are a number of spreadsheets available online or from books that help you calculate risk, stop-loss level and trade position size, but I prefer a tool I have been using for a couple years now called the Forex Calculator.  It’s another great tool from Forex Smart Tools (forexsmarttools.com).  A few months ago, I reviewed the Forex Trade Log, which is another tool I’ve used.

The Forex Calculator is particularly helpful in determining your stop loss when you are trading manually.  It’s not used in creating automated trading systems, although it’s quite useful as a “sanity check” to see if the stops you are using make sense.  But its intended use is to help you determine stop-loss placement and position size when you are placing a trade.

A quick overview of the program is in order: The Forex Calculator has several tabs for Scaling in, Open Cost Averaging, and other multi-leg plans, where the math for stops and position size can get quite complicated.  But to be honest, when I use the tool, I almost always go to the “Quick” tab,  where I just enter in my buy or sell price, and an estimate of where I want to put the stop, and the calculator chooses the position size based on my 1% risk profile.  I can adjust my stop level up or down until I am satisfied that I have at least a 1:2 risk to reward level.

Let’s talk about that for a minute.  When you set your stops, what you are actually doing is saying “I’m willing to lose X amount of money if the trade goes the wrong way in return for a gain of Y if the trade goes in my direction.” In other words, my target to close the trade at a profit should be twice as far out there as my stop loss.  It wouldn’t make sense to aim for 5 pips of profit and have a stop loss at 10 pips—you’re risking a lot to make only a little.  Now, in the actual course of trading, you might find that you didn’t reach your profit target, and you only got 5 pips of profit before you had to close the trade, but the point is that your trade set up should aim to have a larger reward that your risk; that is, a risk-to-reward ratio of more than one.

OK, back to our discussion.  The Forex Calculator helps us determine where to place our stops so that we are not risking too much of our account.  It protects us from ruining our accounts.  That’s awesome.  If you haven’t seen this tool, take a look at it; I’ll have the link to it in the show notes.  Or find one of the free spreadsheets that does some of the same stuff.

Here’s another tool that you can investigate in your manual trading, and this will segue into the automated trading section of this podcast.  Trailing stops are stops that move along with your trade.  First of all, note that you still need to place a regular stop-loss on your trade, in case the trade moves against you right away, so don’t forget about that.  But a trailing stop is a stop that kicks in as soon as your trade is profitable.  A trailing stop will always move up with price (for a buy, anyway), never down.  (Obviously for a sell, it’s the opposite direction).

So, as you probably know, price fluctuates up and down once you open a trade. Let’s say you’ve opened a trade on the Euro, and you have a profit target of 50 pips, and you’ve set a stop loss at 10 pips below your entry.  Price moves up 40 pips, and then moves down to where you opened the trade, and then it goes down 10 more pips, and you’re out at a loss.  Bummer.  If you’re thinking what I’m thinking, you’re thinking “Nuts.  I should have sold it at 40 pips profit!”   A trailing stop can help you here.  A trailing stop has 2 components when to start, and how far back to trail the price.  So, let’s say we set our start at 15 pips profit, and our trailing number to 10 pips.  Back to our example, you buy the Euro, and price moves up 15 pips.  As soon as that happens, a new stop-loss gets set at 10 pips below where price is right now.  Then price moves up to that 40-pip level, as in the previous example, and our stop loss is now 10-pips below the current price.   Now, when price turns around, it will hit our stop, and the trade closes in profit!  Instead of the loss we saw earlier, we have a profit of, I think, 30 pips.  Sure, we didn’t make our target of 50, but we preserved some of that upward movement.

So, here’s the best part.  If we are writing automated systems, we can use indicators and other math to set our stops for us automatically.  This idea comes from Jake Bernstein’s book “The Ultimate Day Trader.”  The idea is to use a 3-period moving average of the high or low to set your trailing stop.  For example, if you want to set a trailing stop for a long position (that is, a buy), you take the low value for the last 3 bars and divide it by 3.  That’s where you set your stop.  Each new bar will re-calculate the placement for that stop, based on the average of the previous 3 bar’s lows.  Simple, but effective.  This allows you to have a trailing stop that follows price, but isn’t so close to price that normal volatility will trigger the stop.

Every trading platform has moving average calculation built in, so creating a strategy and using the 3-period moving average to set your trailing stop is easy and much better than a fixed stop.  You can broaden the range a bit by using a 5-period moving average, and so on.  Don’t forget, you still need to set an initial stop, but once your trade moves into profit, this moving average trailing stop kicks in.

There is one indicator that is often used to set stops as well, and this is called the Parabolic Stop and Reverse, also known as the Parabolic SAR.  This indicator was designed by J. Wells Wilder, Jr.   In its calculation, it uses an “Extreme Point” which is the highest price point during an up-trend, and the lowest price point during a down-trend.  The indicator’s formula has a multiplier that “accelerates” each time a new extreme point is reached.

Take a look on your trading platform, and set up Parabolic SAR and see if using it to set stops works for you in manual trading.  If you like how it behaves, you can try to use it in your trading systems.  In Metatrader, the function is called iSAR(), and it has all of the standard parameters such as currency pair and time frame, but also the acceleration factor is something you can play with.  The standard value for this is 0.02, but experiment with it to see how it works.

One note of caution and that is that the Parabolic SAR only works in trending markets; in sideways markets, you get whipsawed back and forth, and it’s ugly.  Wilder recommends determining the upward or downward trend first, and then implement the SAR.  (As an aside, how do we determine the trend?  Well, that’s a topic for a whole different podcast.)

Ok, the last thing we’re going to talk about regarding setting stops in automated systems is from an article in the June 2013 issues of Futures Magazine, titled “Setting Stops the Bayesian Way”.  The author, Burton Rothberg, describes a way to use statistics to determine where your stops should be over time.  His article is geared towards longer time frames than I typically trade, but the article is quite interesting, and I think it can be adapted to shorter time frames. I suspect this won’t work well with very short time frames, but it should work well for 4-hour, 8-hour or day charts just fine.

I will link to the article in the show notes, but here’s the gist of the idea.  You pick your profit target, and you pick when you think price will rise to that point (assuming we are going long).  For example, say we are trading the Euro, and we go long at 1.3280, and have a profit target of 1.3380 in 10 bars.  We have a difference of 10 pips, over 10 bars.  That means we should be rising 1 pip per bar.  I realize that price doesn’t move like that, but stay with me.   So, Rothberg defines that progression of prices as the “assumed path”.  At each bar, you will have an actual price, and you subtract the assumed path price from the actual price.  Then the Bayesian math is used to calculate a statistical value called the “mean of distribution” from the current price.  That’s the deciding factor.  If the mean of distribution is less than the assumed path value, then we stop out.

In general here’s what’s going on: our path from current price to our target profit is a straight line.  Using the statistics, we can see if we’re on target to get to our profit or not.  If we’re not on target to get there, we stop out.

I contacted the author Mr. Rothberg about this, and he said that shorter time frames, but he also said that the point of this wasn’t to create something that would blindly spit out stop loss levels, but to assist the trader.  In his words, “this is not purely a deterministic model that will input a price series and output a decision. It is meant to be a way of combining the trader’s judgement and price action.”   So, less an automated system and more a trader’s assisting tool.

We don’t have time to go into the math for this here, but Rothberg provides a neat spreadsheet to experiment with the Bayesian calculations.  If you check out the article on the Futures Magazine web site, you’ll find a link to the spreadsheet there.

So, in review, we discussed setting stops using the Forex Calculator, using trailing stops, programming in a 3-bar stop, and then looking at Bayesian math to help set stops.  You can see that you can use lots of different methods to calculate where to put your stops.  This might be harder to do when you are trading manually, but you can incorporate many of these ideas into your trading systems easily.  The goal of stops is to lose as little as possible when price goes against you, and gain as much as possible when price moves in your favor.  Don’t forget that.

Stop wasting time. Scan!

How much time to do you spend every day looking for a trade setup?  If you have a good system, and you know your setups well, do you spend a long time looking through a dozen stocks or currency pairs, checking to see if your setup is there in each one?

I’m getting more and more excited about the idea of scanning.  With scanning, you only need to program in your setup criteria, which financial instruments to scan, and let the scanner tell you which stocks, futures or currency pairs look like they’re getting ready for your set up.

The trick is, of course, to write the scanner, but that’s what we’re here for, right?  A scanner is a lot like writing an indicator for a trading platform, but instead of drawing it on the screen for one chart, the scanner checks multiple charts, and just lets you know which chart might be the ones you should look at.

In John Person’s book Mastering the Stock Market, he spends a bit of time talking about scanning.  It’s in the section on Relative Strength, which I wrote about last week.

scanning-jpm-chartSo, a quick recap here.   On the chart, the top graph is the stock we want to trade; in this case, JPM.  The lower graph shows the relative strength of the JPM stock with the financials XLF Exchange Traded Fund.  Additionally, on the bottom graph, there’s a 9-period moving average that gives us some cross-over points.

Where ever the moving average and the Relative Strength lines cross, that’s a change.  If Relative Strength is above the moving average, that means our stock is doing better than the rest of its industry, and we want to be in that stock.  When the Relative Strength line falls below the moving average, that means it’s doing less well than the rest of the industry, and we want to be out of that stock.

So, how about scanning?  The scanner needs to do the following for each stock (let’s just stick with stocks for now, and let’s assume we’re using daily charts)

  1. Look up the associated ETF or index for the given stock
  2. Load the daily chart for the stock
  3. Load the Relative Strength indicator for the the stock and the paired ETF
  4. Apply a moving average to the Relative Strength buffer
  5. If the moving average has crossed the Relative Strength in the last few days (configurable), alert me.

It would be fairly simple to do this with a variety of platforms, and we looked at something like this from Howard Bandy in his Quantitative Trading Systems book.  We’ll look at that more closely in an upcoming blog post.

 

Multiple time frame use in trading systems

When we first start to trade, one of the rules of trading is “Don’t try to trade on multiple time frames.  Stick to one time frame.”  For a beginning trader, that makes a lot of sense.

When I first started trading I wanted to use a dozen indicators, and have multiple time frames up so that I could see every possible tool that would tell me which way the market was moving, and thus ensure I was placing my trade in the right direction.

However, what ended up happening (you can see this coming, right?) is that instead of all the indicators and time frames aligning, I got conflicting information.  The 15-minute chart would be showing a nice uptrend, whereas the 1-hour or 4-hour chart would be trending down; moving average cross-overs would be telling me it’s time to buy, but the RSI would be telling me to sit still.  More information is not better for a beginning.

What I needed to be told was “watch the market and learn how it moves.”  Use a single time frame, and one indicator, and learn it.  Even if the indicator doesn’t provide great buy or sell signals, it’s so valuable to learn to watch for certain signals, patterns, and market behavior; once you’ve figured that out, you only need one or two indicators, and the rest is just observing and watching for what happens in your trade setup.  Expert traders I’ve studied definitely do use multiple time frames, watching for “confluence”, where a higher time frame confirms a support or resistance level seen on your current time frame.

On the other side of things is the automated system developers.  I’ve seen a number of books and articles that describe how to use multiple time frames in a strategy to confirm a trend or use the higher time frame to determine what kind of market we are currently in.  Howard Bandy uses a higher time frame in several of his strategies in the two books I have,  Quantitative Trading Systems and Mean Reversion Trading Systems.

Because we’re peeking at multiple time frames inside the program code, it’s a little easier to do.  We don’t need to worry about getting confused or having too much going on at the same time, because the computer will be just fine with multiple time frames.  It’s not a good idea to just throw it in the program anywhere; obviously, it needs to be part of the greater strategy you are trying to implement.  Trading strategies can often benefit from extra confirming checks using multiple time frames.

It’s a little tricky to get the trading platform to see two time frames at the same time.  In Metatrader, many function calls require an “int timeframe” parameter, and we use a zero there to indicate the current time frame.  If we are writing code that uses multiple time frames, it is likely you will know the time frames in advance (say 15 minute and hour charts), so in each indicator, you will need to specify which time frame that calculation is being done for.

If you’re organized, it shouldn’t be hard; using the additional longer time frame will give you the confirmation you’re looking for.

 

Comparative Relative Strength

I’ve been reading some of John Person’s books lately.  If you haven’t read anything by him, you owe it to yourself to get a hold of his trading books and read them.  Seriously, they are some of the best material that I’ve read on trading.

I recently picked up Mastering the Stock Market again in preparation for my interview with John, and one chapter in particular caught my eye–the chapter on Comparative Relative Strength.  (Note that this shouldn’t be confused with the “RSI” indicator, which is the “relative strength indicator”.  The two are completely different.)

The basics of Comparative Relative Strength (CRS) is that you take one chart and divide it by another. The result is a simple line graph of the relative strength of the two markets.  The line graph is the “difference” between the two charts.

For example, you might take the chart for JP Morgan (JPM) and do a relative strength comparison to the XLF financial sector ETF.  What this does is it tells you how those two markets compare to each other.  This is specifically interesting when you compare a stock and a sector ETF, because it tells you how well the stock is doing compared to the rest of the stocks in its sector.  This is one way to do sector analysis.

Another way to use this would be to compare an individual stock with the S&P 500, which will tell you how the stock is doing compared with the broader market.

So, if the stock and the market we are comparing it to were exactly aligned, the result would be a straight line.  Not interesting.  However, when we compare JPM and the XLF, we see places where the stock is outperforming the rest of the financial market where the CRS line is trending up.  That’s good to know, especially when evaluating a stock. You not only want to know how it’s doing individually, but especially how it’s doing compared to its sector.

I set up this exact pair on both the ThinkOrSwim platform and the Amibroker platform, and it works beautifully on both platforms.  With ThinkOrSwim, the indicator is called RelativeStrength, and you set up the one stock in a chart, and set up the Relative Strength chart in a lower sub-graph.  In Amibroker, it’s a function called RelStrength.  It appears to be common enough that it is likely to be in other major platforms as well.relative-strength

Here’s the best part of the chapter: you can apply a moving average to the Relative Strength line and use that as a buy or sell signal.  The same way you might have used a moving average on just a stock in the past, you can now use a moving average on the relative strength of a stock within its sector.  Because moving averages act like automated trend lines, you can program a system with a moving average to alert you of changes in the trend.  That means when a stock begins to outperform its sector, you can be alerted of this fact (and buy); when the stock performs poorly compared to its sector, you can be alerted that the trend is over.  John describes how you can use this CRS with a moving average system to write a tool to automate the signals.  Though not a full trading system, it would be used to alert you of stocks that are outperforming the rest of the market, as well as stocks that are under-performing.   The automated alert system would scan for the change in relationship to let you know when a stock was trending higher than the market or ending that trend.

If I were to pick one project to work on next, this would be it.   Sector analysis is powerful, and it should definitely be part of your tool box.

Trader Tech Talk 008: Interview with Trading Master John Person

John has an amazing episode in store for you this week!

This week’s episode is John’s interview with none other than John Person, trading veteran of 33 years, and author of numerous best-selling books on trading.John Person headshot

In this episode, you will learn from John

  • The one thing beginning traders do wrong
  • How to scan for stocks
  • A little known tool for finding hot markets

Resources

Let us know what you think of the interview!