Playing with the Bands (2) – “From Squeeze to Momentum Burst”

Post on: 23 Апрель, 2015 No Comment

Playing with the Bands (2) – “From Squeeze to Momentum Burst”

Playing with the Bands (2) – “From Squeeze to Momentum Burst”

8/29/12 5:47 PM

Blog 6: Playing with the Bands (2) – “From Squeeze to Momentum Burst”

The interesting thing about designing a trading algorithm is that you can collect the existing ideas, put them together, and add a bit of your “flavor” to create your own trading style. Let’s give it a try. Last week we learned about the Bollinger Bands (you can find the article here ). Today we will introduce a squeeze system, in which we add 5 different components along with Bollinger Bands. These components are Exponential Moving Average (EMA), Momentum Index, Average True Range (ATR), Keltner Channel, and Market Indicator. This system is designed to identify stocks with great momentum that are ready to burst. Once these stocks start to move, we can capture the huge run on them. Before we delve into the trading strategy, let’s walk through a quick introduction of the five indicators:

Exponential Moving Average (EMA):

As we mentioned in the previous article, the simple moving average can show the current trend direction but with a lag. Exponential Moving Averages will reduce the lag by applying more weight to recent prices. The weighting applied to the most recent price depends on the number of periods in the moving average as seen in the following formula,

where the Time Period denotes the periods of exponential moving average you want to use, and t denotes the current time.

Momentum Index:

The Momentum indicator is a speed of movement indicator, which is designed to identify the strength of a price movement. Usually, the momentum indicator compares the most recent closing price to a previous closing price. The formula is as below:

where n is a specific length of the previous closing prices. The momentum indicator identifies when and by how much the price is moving upwards, or downwards, with the indicator above 0 moving upwards and below 0 being downward.

Average True Range (ATR):

This indicator is developed by J. Welles Wilder to measure the volatility. One common way to measure volatility is to calculate the standard deviation by just using previous close prices. It would fail to capture volatility form the gap or limit moves of stock price. To capture the missing volatility, the ATR indicator uses three different ranges of the stock price to capture that missing volatility. Let’s go through the steps and calculate the ATR.

  1. Calculate the True Range (TR) by taking the greatest value from the following calculation.

A gap occurs when the previous close is greater than the current high, which signals a potential gap down or limit move, or the previous close is lower than the current low, which signals a potential gap up or limit move.

2. Calculate the n-period Average True Range (ATR) :

Keltner Channel:

If you are already familiar with Bollinger Bands, this indicator will be quite easy for you. Keltner Channels are volatility-based envelopes. Different from general Bollinger Bands, Keltner Channels use exponential moving average as its mean(central line) and use the Average True Range (ATR) to set the channel distance. The channels (the upper band and the lower band) usually are set two ATR values above and below its mean. You also can use this indicator to play the revert-to-the-mean strategy. Now you may wonder what are the differences between Bollinger Bands and Keltner Channels? First, as we stated above, the mean in Bollinger Bands is using simple moving average, while the mean in Keltner Channels is using exponential moving average. This would make the Keltner Channels more sensitive to the recent price movement. Second, the Keltner Channel is smoother than the Bollinger Bands. Why is that? Now we all know that the width of Bollinger Bands is decided by the standard deviation, which is calculated based on the closing prices. Since the closing prices are more volatile than the trading ranges, it makes the Bollinger Bands tend to expand and contract faster than the outer bands of Keltner Channels. This characteristic is pretty important, and will be the core of our following strategy.

Market Indicator:

The market indicator is chosen to gauge how the overall market goes. You hope these indicators can give you a sense about the market sentiment, like the current market is in an uptrend, consolidation, or downtrend. Why is it important? If you have a long-only strategy, will you put all your money in when there is a big selloff in the market? Absolutely NOT! It doesn’t mean that you can’t buy stocks in a weak market; in fact, many people will see it as a good opportunity to build positions. However, it does give you a heads-up so that you won’t blindly throw out a trade. So where can we find these indicators? It’s pretty easy. For example, VIX is a well-known fear index provided by CBOE, so you can use it to gauge the market environment. When the market is in its selloff mode, the VIX usually rallies. When the market rallies, the VIX usually dips hard. It tends to run the opposite way of where the market goes. Thus, it can be a good market indicator to include in your trading algorithm. The other indicators can be market indexes, index ETFs, or sector ETFs. The idea is that you want to find one that is highly correlated with the stocks you are trading with. Let’s look at a short example. If you trade many stocks in the S&P 500 index, you can use SPY, in which case the ETF closely tracks the SPX performance as a market indicator.

Playing with the Bands (2) – “From Squeeze to Momentum Burst”

Now let’s start building our strategy using all these fun indicators. First, we need to grasp the key concept behind this strategy. As we mentioned above, usually the outer bands of Bollinger Bands would be outside the outer bands of Keltner Channels. So the question becomes, is it possible to see both the upper and lower Bollinger Bands come inside the Keltner Channels? When will it occur? And what does it mean? The answer is YES. It usually occurs when the market is under the low volatility period. This quiet transition period is called squeeze and can be seen as the time when the stock or market is accumulating momentum and waiting for reaction. Once the period ends and the Bollinger Bands start to come out of the Keltner Channels, the momentum starts to release and a big move is coming. We just don’t know which way — either upside or downside — will it move. To figure out how which side the stock will go, here is the Exponential Moving Average and the Momentum Indicator come into play. Let’s take a look at the strategy:

Buy the stock when the following criteria are all met:

  1. The outer bands of Bollinger Bands come out from the Keltner Channels (Squeeze is finished)
  2. The 8-period EMA is greater than the 21-period EMA, and the 21-period EMA is greater than the 55-period EMA
  3. The Momentum index is greater than zero
  4. The specific index ETF is above its 34-period EMA (We use it as the market indicator)
  5. The current volume is greater than its 10-period Moving Average

Close the stock positions when either one of the following criteria is met:

  1. Use the entry price minus 1.5 ATR as our original stop
  2. Target 1: the entry price + 1.5 ATR. Once we hit the target, close half of positions and bring up the original stop to break even
  3. Target 2: Close the rest positions when the 8-period EMA cross to the opposite side of the 21-period EMA

Once the squeeze period ends and the stock is ready to move, we use 4 more steps to decide which direction we should go. (1) First we will have to see whether the 8-period EMA is greater than the 21-period EMA, and whether the 21-period EMA is greater than the 55-period EMA. These two measures tell us whether if the stock is relatively stronger or weaker in short-term than medium-term. (2) Second, the Momentum Index needs to be greater than zero, which further confirms that the stock has an upward momentum. (3) Third, we have to consider whether the market indicator is relatively strong in the medium time-frame so that the market won’t hurt our position badly. (4) Finally, the current volume of stock needs to be at least greater than its 10-period MA. It indicates that the recent volume is increasing to support the momentum. You may change this one to more strict condition, like the current volume should be greater than 250,000 contracts. In terms of closing existing positions, we inclined to use one systematic exit methodology to reduce our downside risk and simultaneously give us a room to profit from the upside. First, when we open positions, we have the hard stop in place, which is the entry price minus 1.5 ATR, to cut our loss short if the stock doesn’t perform well. Second, we use the entry price plus 1.5 ATR as our first profit-taking target. Once we hit this target, we close half of our positions and move our original hard stop to break even. In this way, we book some profit and take some risk off the table, but we still have our remaining positions exposure to the upside. Lastly, remaining positions will be closed either when the 8-period EMA cross to the opposite side of the 21-period EMA or be stopped out by our stop. By doing so, we can catch a runner if the stock keep performing strong. Even if our positions be stopped out, it would be stopped at our breakeven price, and remember we already take some profit in our pocket.

We use LNKD as an example. From the chart above, we observe that (1) we got a squeeze signal at 1/12/2011. (2) The volume met our criterion. Those two steps indicate a good potential setup for us.

(3) We saw the 8-EMA cross over the 21-EMA. (4) Momentum index was above zero, which indicated an upward momentum. (5) QQQ (The Market index we chose for our stocks) was above its 34-EMA line, which also signaled the market was relatively strong in the medium-term time-frame All the criteria were met, so we bought the stock at this point. Then we waited for the crossover of 8-EMA and 21-EMA in the opposite side. We had an amazing run-up and held our position for about 4 months until 5/21/2012, and eventually we booked around 50% profit per contract. Now let’s backtest this strategy with stocks listed in NASDAQ.

Table. Backtesting result on all stocks listed in the NASDAQ (1/2/2001

6/11/2012). Here we use 100K portfolio and put 1% capital ($1000) per trade, and assume the 10bp for one-way transaction fee of our trade capital.

Though we can see that the winning ratio of this strategy is not high, we still make a decent profit from this system. Comparing our equity curve with the simple buy and hold strategy for QQQ, we can find that our performance totally beats this benchmark. We generated a great uptrend in our equity curve even though the market was up and down drastically. We did get hit a bit around the years of 2008 and 2009. However, given our strategy is a long-only strategy, our loss was contained during one of the worst periods in the financial history. You may question why the result can be so great while we only get around 50% winning ratio? Notice that every system has different characteristics. Let’s take two totally different types of strategies, revert to the mean strategy and momentum strategy, as an example. When you trade a mean-reverting strategy, you will expect that there’s a high probability the stock price will go back to its mean. This way, you can design your strategy to profit from that characteristic. Usually you can get a high winning ratio in this kind of system. In contrast, the momentum strategy has a totally different nature. The goal in this kind of system is “Let the winner run and cut the losers short”. We can be comfortable to experience several small losers in a row. But as long as we catch a runner, we can have a huge profit to fairly offset the previous loss and meanwhile retain a good profit. The system we are introducing today belongs in this category. Thus, we shouldn’t worry too much about the relatively lower winning ratio. Instead, we can focus on how much we can earn if we are right. Take a look at the average profit per winning trade versus the average loss per losing trade, we get almost 2 times more when the trade works in our side.

As we have mentioned in some of our previous posts, we should have different trading strategies in our trading portfolio to help us profit from different market environments. Now, you have one more. Hopefully, you enjoyed this one a lot and allow your imagination to dive into the world of algorithmic trading.

For more information about EquaMetrics and the Rizm platform please visit EquaMetrics.com .

Categories
Stocks  
Tags
Here your chance to leave a comment!