My Bollinger-Band-Based Swing Trade System in Action

SPLK-b-to-b-tradePreviously I described a swing trading system using Bollinger bands here. I just completed a trade using this system, and I’ll describe it to you. It’s hardly breaking the bank, but the trade was a winner and that beats the alternative!

On December 17th, 2014, I received a signal to enter Splunk Inc (SPLK). The criteria you can read about in that previous post, but essentially the entry point is four bars with their lows below the Bollinger band, followed by a green bar with the low above the Bollinger band. Meanwhile, a 50-day moving average (beige line) must be above the 70-day moving average (green line).

The entry signal is marked above, and I enter the next day upon the opening bell. I set a stop loss of 14%, which is a “soft” stop. In other words, if the close of the day falls below the entry price * .86, I exit the following day at open. This is not a hard stop set with the broker that can be triggered on intraday movements.

Otherwise, the exit is something like the mirror image of the entry. I watch for the highs to ‘pierce’ the upper Bollinger band. When they do, I look for the first day that does NOT pierce its Bollinger band. At which point, I exit the following day. The exit-signal day shown above was for yesterday, and I exited this morning (but don’t have the end-of-day data to show it on a graph yet).

If you look closely, you’ll notice that the bar prior to the green entry-signal bar does not actually have its low piercing the Bollinger band. “What’s up with that?” you ask. I actually entered into this trade before I realized that a Bollinger band with a period of 15 worked slightly better than the standard 20. So the entry was based on a 20-period band, but the exit would have been the same for either type of Bollinger band.

This was a long and boring swing trade: 36 trading days. Sometimes I wanted to shake my computer monitor and shout “C’mon Splunk! DO SOMETHING!” And many times I would yell (in my head) “NO, do something the OTHER direction!” And over all that time I made just under 2% before commissions. Not exactly stunning, but it does show you how the system works. And I did outperform the S&P 500 during this period by .7%. Which, given the recent turbulence, is nothing to sneeze at.

Charts can be a little boring so here's a random image...this one a double-exposure shot in Las Vegas.
Charts can be a little boring so here’s a random image…this one a double-exposure shot in Las Vegas.

Stock Market Health Indicator for ProRealTime


Most of the trading systems I use are for long positions, and as a result they only work when the market is in a healthy state. However different systems require different conditions to be met. For example, most of my systems (long term or swing-trade) require that the S&P 500’s 40-day moving average be greater than the 120-day moving average. However, several systems I use require not only that condition, but also that the 120-day moving average be the highest of the last 50 periods. And at least one system requires that the S&P’s Close of the previous day be greater than the 120-day moving average.

So I’ve set up a handy indicator in ProRealTime (awesome free charting software) to give me an instant view of the current market’s health. Basically, if the black line is at the top (at 3) and the bar is light green, then all conditions are hit. If the black line is lower than 3, then I need to take a closer look to see what condition is not being met.


First, the code:


RETURN level1+level2+level3 AS “combined”, level1 AS “fma>sma”, level2 AS “sma highest”, level3 AS “close above”


In the upper right corner of the ProRealTime chart window you’ll see the little pop-up menu icon (circled below in green). Click on the arrow and select “indicators”.

spy-alert-indicator2The Indicators window will open, and it’ll look like what you see below. Click on the “new” button at the left.


Below you can see the coding section for indicators. Paste the code from the beginning of this blog post in here. Give it a catchy name at the top, like I did. Then click the big “Add indicator to chart” button in the lower right corner.


The indicator will initially be a bunch of angular black lines. Let’s go fix that! Your new indicator will be in a sub-window at the bottom. Click the wrench icon in that sub-window to edit the indicator.


Below you’ll see the indicator settings. The “combined” sub-indicator should be fine as a black line, but you can mess around with color and style if you’d like. But click on each of the other sub-indicators and turn their style setting to “histogram”. And pick colors for them. The lowest in the set will display in front, so I have set the “fma>sma” bar to dark green the “sma highest” bar to medium green, and “close above” to be light green.

spy-alert-indicator6Before closing the window, click on the title of your indicator on the left, then select the check box at the bottom to set these color/style settings as the default for your new indicator.


I created a new template for this, so I can call everything up in one click. Select “SPY” as your ticker symbol, make sure your indicator is showing below, and then go up to the Templates menu and save a new template.

And then, very important, save your work! PRT has a funny way of not saving things before it quits on its own. Bad robot!

This is just a quick little code snippet and I might refine it later, but it’s useful to integrate into my pre-trade checklist. There’s nothing worse than committing money to a trade, only to realize you forgot to check something first. This helps me not screw it all up, and perhaps it will help you too.

Exiting a Swing Trade During Earnings Season

If you've made a mistake with a trade, there's no shame in finding the exit.
If you’ve made a mistake with a trade, there’s no shame in finding the exit.

Don’t accidentally swing trade a stock during earnings season, like I did!

On January 27th I entered into a momentum-anticipation swing trade with Pacific Biosciences of California (PACB). I had a tight buy-stop above the previous day’s high, which was triggered at $8.15/share.

I did know enough to check their earnings report date, but I didn’t know the best places to look. Nothing on, nothing on…so I dove in.

The stock did nothing after that mini-burst that got me into it, and continued trading in a small range.

THEN I get a news alert at the end of last week, saying PACB would announce earnings info after the close on February 3rd.


Hmm, what to do, what to do. I didn’t get into this trade to bet on an earnings surprise. While pointless for predicting the future, I read analyst reports and looked at previous earnings, actual vs projected…and I came to the conclusion that I had not the foggiest notion as to what PACB would do after revealing their quarterly numbers.

So I put a reminder in my calendar before the closing bell yesterday to sell that puppy. It was very close to what I bought it at, so I put in a sell-limit order that would cover my initial investment plus my commission, and hoped it executed. If it didn’t, I would have pulled the trigger anyway at the end of the day.

Fortunately it was triggered, and I lost a total of $0.60 on the transaction. Not per share…total. 🙂 I’ll call that a wash.

In the mean time, I’ve found a nice and succinct earnings calendar on the NASDAQ site, which tells you when the next report should be coming up. It’s one thing to bet on a report with your eyes open. But otherwise, check your stock for upcoming reports before entering into that trade!

P.S. PACB reported an EPS unchanged from last quarter. And the stock is down 18% as I write this during midday trading. Glad I found the exit!

DTO: Shorting Oil For Fun and Profit

The black bands are what I used to test my proposed trailing stop, so that I knew the stop wouldn’t be triggered by previous consolidation periods.

Much of what I write about on this blog concerns short-term trading systems, or “swing trading”. That’s not because my portfolio consists mostly of swing trades…it’s doesn’t! Most of my money is tied up in longer-term plays. It’s just that, well, they’re not that interesting to talk about. You do your research, you buy the stock, and then you check in every once and awhile to see if it would like a sandwich or a cold beer. Which does not make for riveting reading.

But I just completed a trade that was a hybrid duration. Longer than a typical swing trade, but not a truly long-term proposition. That’s because I was “shorting oil”.

Back in December, there was a lot of talk about oil prices continuing to fall. This isn’t news to anyone who has been semi-conscious for the past few months. But at the time, those “in the know” were saying silly comments such as “oil won’t fall below $70/barrel” etc. Usually when people start saying something could never happen, those comments turn around and mug them in a dark alley. And meanwhile, the Saudis sounded very much like they were keen on having prices fall through the floor. I have my own geopolitical theories about that, but the ‘why’ isn’t all that important. When it comes to trading, ultimately the price is king. Suffice it to say, I thought it was a good bet that oil might fall to $50 or even – gasp! – $40.

Since I’m not currently prepared to trade options or short stocks, I looked around for a ‘reverse’ oil ETF. Basically this was a security that moved up when the underlying commodity moved down, and vice versa. I wanted to ‘short’ oil without all that pesky margin requirement for short selling.

So I found the PowerShares DB Crude Oil Double Short Exchange Traded Note (say that three times fast), ticker symbol DTO. Why did I pick the “double short” version? Because it uses leverage to double the inverse movement compared to oil. When I calculated the volatility of the “single short” version, it wasn’t enough to justify the amount of capital I needed to invest. In other words, the risk was too small to justify me tying up my money. I needed a higher potential return for the amount of capital I was willing to invest, and the double version fit the bill.

So how to go about this trade? I figured I’d be in it a few weeks or a few months at the most. I knew that this trade did not have the potential to last years and years, because oil would eventually head back up. So a trailing stop was in order, but a tighter one than what I would use for a long-term stock trade.

My first thought was “hmm, how about 2 X the Average True Range below the highest low of the trade?” The 14-period ATR at the time was 2.8681, so twice that is $5.74, rounding up. That was my proposed trailing stop. For each trading day that had a new higher low, my stop would move up so that it was $5.74 below that low. If a subsequent low was lower, the stop doesn’t move. The trailing stop only goes one direction…up. When the price finally closes below that trailing stop amount, I sell the next day.

Note that this stop, like for most of my trades, is not a ‘hard’ stop. I don’t act on intraday highs and lows, but only on the close of each day. If the close is below the stop, I sell the next day at the opening bell.

I did some quick calculations to see how the stop would have fared during earlier consolidation periods in the recent run up. I wanted my stop to be loose enough to make it through these consolidation periods without “stopping out”, but not so loose that I gave back too much profit when the tide turned. You can see the bands I tested on the first image above. The stop I had picked gave just enough wiggle room.

So how did I do? Pretty well, thank you! I did give back a sizable chunk of money in the past couple of days. But even so, I bought this at $68.87 on December 11th, and sold it this morning for $95.30. That’s gain of 38% in about seven weeks.

The pink line is where my trailing stop ended up, which was then hit on Friday’s close.

I must admit, it’s been perversely fun to root for oil to keep falling. Money in my gas tank and money in my portfolio at the same time! But it did also suck that the rest of the market (and the rest of my portfolio) has been less than happy with the falling price of oil. Perhaps oil is finally slowing its descent, and maybe the markets will stabilize.


Momentum-Burst Swing Trade: RLYP

Well they can’t all be good trades. And it would be disingenuous of me to only show the good results! Here’s one that went bad, and quickly.


I frequently read the Stockbee blog, written by Pradeep Bonde, as well as keep an eye on the “Coiled Spring” screener found on the Alan Farley’s Hard Right Edge website. Both sites spend a fair amount of time discussing momentum-burst trades. In a nutshell, this is when a stock had a big run up, then pauses to catch its breath, and then bursts out again. I also have my own screener which brings up a bunch of potential trades each day. One method is to catch the move after the initial burst, which is more conservative because it waits for confirmation, but loses out on possibly the biggest portion of the move. Or you can lie in wait for the burst by using buy-stop orders. That’s what I did with Relypsa, Inc (RYLP).

As you can see above, I set my stop-market buy order for $37.76, with a ‘soft’ stop-loss of $36.07. I say “soft” because most of my stops and profit targets are not executed intraday, nor placed with the broker. Instead, I look at the close of each day, and compare it to the stop or target. If the threshold is met, I sell the next day at open. This makes my life less stressful, as I theoretically don’t have to constantly watch my trades. Except I *do* constantly watch my trades. I’m working through that mental problem, but I digress.

One thing I don’t understand is where I came up with my buy stop price. The stop-loss I understand: I picked a number just a little below the lowest low of the recent low-movement days. But for other momentum-burst swing trades, I’ve been calculating the difference between the two most recent highs, and then adding that to the highest of the two highs for a buy order. Which in this case would have been $38.68. So why did I pick a trigger that was less than the previous day’s high? Did I just look at the chart and say “nah, $38.68 looks too high.”? I can’t remember, which is sad since this was only a few days ago. My notes on this trade are mum on this decision. Well I should have stuck to my (somewhat arbitrary) entry price calculation method, because I wouldn’t have gotten into this trade in the first place.

So the price was hit, and my order was then executed as a market order, with a buy price of $38.04. Let’s see what happened.

RLYP---closeThe stock promptly dropped over 5% the next day, closing below my stop price! So I sold it on January 30th, for a loss of -7.26% before commissions.

So shall we pick through the ashes and see why this one went bad?

Well the markets have been pretty turbulent recently, for starters. However the 29th was an up day, and many of my other stocks were up that day as well. So that doesn’t seem like an excuse.

A couple of problems come to mind:

• First off, that buy-stop placement was just stupid. The whole point of placing the stop order above the recent highs is that you want confirmation that a big move is really happening. By placing it AT the high of the previous day, I hadn’t set it above the ‘noise’ of a normal trading day. So the buy got triggered without real confirmation of an upward move.

• I don’t know if this stock really had enough time to ‘rest’ and gather momentum. I realize that sort of thinking is anthropomorphic and a little fuzzy-minded if it’s not backed up with hard numbers. But none the less, RLYP had a sizable run-up only a few days before I got into it. Just as those who’d already made profits decided to get out, no doubt.

But one larger issue that bothers the crap out of me: I’m making this up as I go along. And I don’t like that.

Unlike other systems I trade, this one is too ‘discretionary’. I haven’t come up with a good way to backtest this system with hard data. Exactly where do I place my buy orders? How and when do I exit a trade? Pradeep at Stockbee is a little vague about these details (no doubt because he’s selling a membership…nothing wrong with that). I read a book by Ivaylo Ivanov and it too is a little vague. It’s possible that systems like these must rely on fundamentals or factors external to simple price and volume data. Which would make backtesting impossible, and thus cause me a lot of anxiety!

I can *see* that this type of system should get results. I just haven’t yet worked out the details. Perhaps more paper-trading is called for here, before committing money to this.