In retrospect, all traders and investors would like to have invested in stocks like Amazon or Netflix early. But how can we detect stocks like these beforehand? Our fist task is to filter out weak trends and in so doing identify stocks with a high-quality trend and then ride the ensuing wave. Markos Katsanos (mkatsanos.com) discribes a simple but effective approach in the November 2018 issue of the Technical Analysis of Stocks and Commodities magazine. He calls it the Stiffness Indicator. The following article describes his concept and shows the backtest results for a simple strategy based on this indicator.
High Stiffness = High-Quality Trend
If you take a look at strong stocks, you can see that trends are made of multiple legs up and some short corrections. Instead of buying the dip, the Stiffness Indicator is a safer strategy, because it waits until a strong and high-quality trend has been established. The calculation of the indicator is pretty simple:
- Multiply the number of times price closed above the SMA (100) during the indicator period (60) by 100
- Minimal penetrations of less than 0.2 standard deviations are filtered out and therefore excluded
- Divide the result by the indicator period (60)
- The higher the stiffness, the stronger the price trend (maximum is 100)
Let`s say stock A has traded above the SMA 100 for 55 days during the last 60 days. The Stiffness Indicator then equals 55 x 100 / 60 = 91.7. So the stock has a high-quality uprend. And here is a practical example. This is a daily chart of Nextlix with the Stiffness Indicator shown in the sub chart panel. Stiffness values above 90 have been a good indication for a high quality trend.
Equilla Code for Stiffness Indicator
Now let us take a look at the code for this indicator. The main trick here is to define a condition (line 14) which is used in the CountIf function in line 18. This way, the algorithm counts the number of times prices were above the SMA 100. By the way, click here if you want to learn more about implementing counters in your code.
Creating a Trading Strategy for High-Quality Trend Following
Having described the Stiffness Indicator, we now want to create a simple trading strategy to backtest it to assess the efficacy of the indicator. As described in the original article from Mr. Katsanos, the rules are:
- Buy Condition 1: Stiffness crosses above 90 (strong trend quality) and
- Buy Condition 2: EMA 100 of S&P 500 is higher than 2 days ago (overall market trend filter)
- Sell Condition 1: Stiffness crosses below 50 (weak trend quality) or
- Sell Condition 2: Bars since entry exceed 4 months (time exit)
Here`s the Netflix stock with the strategy applied to the chart with the default settings suggested by Mr. Katsanos. As you can see, the long entry was generated when the Stiffness Indicator crossed above 90, while the exit was triggered by the time exit (sell condition 2).
Assessing the Efficacy of the Trend Following Strategy
So here`s the code for the Stiffness trading strategy. Because the strategy for the most part equals the indicator, I just would like to highlight one thing concerning the code which could be helpful in general: In line 11 I created an instrument which is referring to the ticker you can enter for the parameter in line 9. It will serve as our market trend filter. The calculation of the EMA of the stock index is done in line 30.
Backtest Results for US Stocks Portfolio
Finally, we can start our portfolio backtest. The good thing about it: We are not only able to see the risk and return metrics of the strategy, but also tweak the parameters and check its robustness. For example, we could eliminate the time exit and try to ride trends longer if they continue further. Or we can change the threshold of the stiffness value when to exit and so on. One thing that is not implemented in the code above is the position sizing rule which we need. I will keep it simple here:
- Every stock is traded with the same amount of capital (initial capital divided by no. of portfolio members)
- Portfolio profits are redistributed equally to all portfolio members (re-investing)
Now let us take a look at the backtest results for the last 20 years using 0.1% as transaction costs. For the portfolio, I randomly picked 30 stocks from the Dow Jones and Nasdaq with sufficient data history. On the left side you can see the back test results with the original settings mentioned in the article. On the right side, I deactivated the time exit, which leads to a higher profit.
Faster Exits and Profit Targets could improve Results
This trading strategy which focuses on high-quality trends can be extended further into a more complex one. Especially the exit could be modified by using a different approach instead of the Stiffness Indicator which already defines the entries. Mr. Katsanos recommends to use faster exits, for example Wilder`s Parabolic SAR (see here). Adding a volatility-based profit target could be another idea.
Tradesignal® is a registered trademark of Tradesignal GmbH. Unauthorized use or misuse is strictly prohibited. Data by Refinitiv EIKON.