Category Archives: technical indicator

The Agony and Ecstasy of Trend-Following

Let’s face it, many investors have a problem with riding a trend.  When things are going well they fret and worry about every blip in interest rates, housing starts, earnings estimates and the price of tea in China, which often keeps them from maximizing their profitability.  Alternatively, when things really do fall apart they suddenly become “long-term investors” (in this case “long-term” is defined roughly as the time between the current time and the time they “puke” their portfolio – just before the bottom).

Which reminds me to invoke:

Jay’s Trading Maxim #6: Human nature is a detriment to investment success and should be avoided as much as, well, humanly possible.

So, it can help to have a few “go to” indicators, to help one objectively tilt to the bullish or bearish side.  And we are NOT talking about “pinpoint precision timing” types of things here. Just simple, objective clues.  Like this one.

Monthly MACD

1

Figure 1 displays the S&P 500 index monthly chart with the monthly MACD Indicator at the bottom.Figure 1 – Monthly S&P 500 Index with MACD (Courtesy AIQ TradingExpert)

The “trading rules” we will use are pretty simple:

*If the Monthly MACD closes a month above 0, then hold the S&P 500 Index the next month

*If the Monthly MACD closes a month below 0, then hold the Barclays Treasury Intermediate Index the next month

*We start our test on 11/30/1970.

*For the record, data for the Barclays Treasury Intermediate Index begins in January 1973 so prior to that we simply used an annual interest rate of 1% as a proxy.

Figure 2 displays the equity curves for:

*The strategy just explained (blue line)

*Buying and holding the S&P 500 Index (orange) line

2

Figure 2 – Growth of $1,000 using MACD System versus Buy-and-Hold

Figure 3 displays some “Facts and Figure” regarding relative performance.

3

Figures 3 – Comparative Results

For the record:

*$1,000 invested using the “System” grew to $143,739 by 6/30/2019

*$1,000 invested using buy-and-hold grew to $102,569 by 6/30/2019

*The “System” experienced a maximum drawdown (month-end) of -23.3% and the Worst 5-year % return was +7.3% (versus a maximum drawdown of -50.9% and a Worst 5-year % return of -29.1% for Buy-and-Hold)

So, from the chart in Figure 2 and the data in Figure 3 it is “obvious” that using MACD to decide when to be in or out of the market is clearly “better” than buy-and-hold.  Right?  Here is where it “gets interesting” for a couple of reasons.

First off, the MACD Method outperforms in the long run by virtue of missing a large part of severe bear markets every now and then.  It also gets “whipsawed” more often than it “saves your sorry assets” during a big bear market.  So, in reality it requires ALOT of discipline (and self-awareness) to actually follow over time.

Consider this: if you were actually using just this one method to decide when to be in or out of the market (which is NOT what I am recommending by the way) you would have gotten out at the end of October 2018 with the S&P 500 Index at 2,711.74.  Now nine months later you would be sitting here with the S&P 500 Index flirting with 3,000 going “what the heck was I thinking about!?!?!?”  In other words, while you would have missed the December 2018 meltdown, you also would have been sitting in treasuries throughout the entire 2019 rally to date.

Like I said, human nature, it’s a pain.

To fully appreciate what makes this strategy “tick”, consider Figures 4 and 5. Figure 4 displays the growth of equity when MACD is > 0 (during these times the S&P 500 Index is held).

4

Figure 4 – Growth of $1,000 invested in S&P 500 Index when MACD > 0.

Sort of the “When things are swell, things are great” scenario.

Figure 5 displays the growth of $1,000 for both intermediate-term treasuries AND the S&P 500 Index during those times when MACD > 0.

5

Figure 5 – Growth of $1,000 invested in Intermediate-term treasuries (blue) and the S&P 500 (orange) when MACD < 0.

Essentially a “Tortoise and the Hare” type of scenario.

Summary

Simple trend-following methods – whether they involve moving average using price, trend lines drawn on charts or the MACD type of approach detailed herein – can be very useful over time.

*They can help an investor to reduce that “Is this the top?” angst and sort of force them to just go with the flowing while the flowing is good.

*They can also help an investor avoid riding a major bear market all the way to the bottom – which is a good thing both financially and emotionally.

But everything comes with a cost.  Trend-following methods will never get you in at the bottom nor out at the top, and you WILL experience whipsaws – i.e., times when you sell at one price and then are later forced to buy back at a higher price.

Consider it a “cost of doing business.”

Jay Kaeppel

Disclaimer:  The data presented herein were obtained from various third-party sources.  While I believe the data to be reliable, no representation is made as to, and no responsibility, warranty or liability is accepted for the accuracy or completeness of such information.  The information, opinions and ideas expressed herein are for informational and educational purposes only and do not constitute and should not be construed as investment advice, an advertisement or offering of investment advisory services, or an offer to sell or a solicitation to buy any security.

Weekly & Daily Stochastics

The AIQ code based on Vitali Apirine’s article in the September issue of Stocks and Commodities, “Weekly and Daily Stochastics, is provided below

Using Apirine’s weekly and daily stochastic indicators and a moving average to determine trend direction, I created an example system (long only) with the following rules:

Enter long next bar at open when all of the following are true:

  1. The 200-day simple average of the NDX is greater than the day before
  2. The 200-day simple average of the stock is greater than the day before
  3. Both the weekly and daily stochastic indicators have been below 20 in the last five days
  4. Both the weekly and daily stochastic indicators are greater than the day before.

I tested three exits. Figure 8 shows a 21-day hold then exit. Figure 9 shows a three-moving-average trend-following exit. Figure 10 shows an exit using only the weekly &amp; daily stochastic, once both are lower than the day before.

Sample Chart

FIGURE 8: AIQ, BUY and HOLD. Here is the sample equity curve (blue) compared to the NDX (red) for the test using a 21-day hold exit.

Sample Chart

FIGURE 9: AIQ, TREND-FOLLOWING EXIT. Here is the sample equity curve (blue) compared to the NDX index (red) for the test using a trend-following exit.

Sample Chart

FIGURE 10: AIQ, W and D STOCHASTIC EXIT. Here is the sample equity curve (blue) compared to the NDX index (red) for the test using the weekly and daily stochastic indicators.

The 21-day hold test showed a 11.2% return with a maximum drawdown of 29.3%. The trend-following exit test showed a 17.6% return with a maximum drawdown of 28.8%. The test using an exit based on only the weekly and daily stochastic indicators showed a return of 2.9% with a maximum drawdown of 32.5%. All the tests used the same entry rule and were run on an old 2016 list of the NASDAQ 100 stocks with the stocks that are no longer trading deleted.

!WEEKLY AND DAILY STOCHASTIC
!Author: Vitali Apirine, TASC Sept 2018
!Coded by: Richard Denning 7/7/2018
!www.TradersEdgeSystems.com

!INPUTS:
Periods is 14.
Periods1 is 3.
Pds is 70. 
Pds1 is 3.
smaLen1 is 70.
exitType is 1.

!ABBREVIATIONS:
C is [close].
H is [high].
L is [low].

!INDICATOR CODE:
STOCD is (C-LOWRESULT(L,Periods))/(HIGHRESULT(H,Periods)-LOWRESULT(L,Periods))*100. 
SD is Simpleavg(Stocd,Periods1).
StocW is (C-LOWRESULT(L,Pds))/(HIGHRESULT(H,Pds)-LOWRESULT(L,Pds))*100.
SW is Simpleavg(Stocw,Pds1).
HD if hasdatafor(1000) &gt;= 500.
SMA200 is simpleavg(C,200).
SMA200ndx is tickerUDF("NDX",SMA200).

!SYSTEM CODE:
Buy if SMA200ndx &gt; valresult(SMA200ndx,1)
          and SMA200 &gt; valresult(SMA200,1)
          and SW &gt; valresult(SW,1) 
          and SD &gt; valresult(SD,1) 
          and countof(SW &lt; 20,5)&gt;=1 
          and countof(SD &lt; 20,5)&gt;=1 
          and HD.
smaLen2 is smaLen1*2.
smaLen3 is smaLen1*4.
SMA1 is simpleavg(C,smaLen1).
SMA2 is simpleavg(C,smaLen2).
SMA3 is simpleavg(C,smaLen3).
PD is {position days}.

!EXIT TYPE 1 USES THE INDICATOR ONLY
!EXIT TYPE 2 IS TREND FOLLOWING
Sell if (SD &lt; valresult(SD,1) and SW &lt; valresult(SW,1) and exitType=1)
       or (exitType = 2 
           and ((Valresult(C,PD)valresult(SMA1,PD) And Cvalresult(SMA2,PD) And Cvalresult(SMA3,PD) And C 250)).

RSS is C/valresult(C,120).
RSL is C/valresult(C,240).

—Richard Denning

info@TradersEdgeSystems.com

for AIQ Systems

An Obscure but Potentially Useful Oversold Indicator

Trend-following is essentially a “tried and true’ approach to investing.  But overbought/oversold (i.e., attempting to buy low/sell high) – that’s where the “excitement” is.  Of course, when it comes to trading and investing, “excitement” can be highly overrated.  Nevertheless, in this piece I want to talk about a relatively obscure indicator that may be useful in identifying vastly oversold situations.

EDITORS NOTE: The AIQ EDS file for Jay Kaeppel’s indicator is available to download at

The VixRSI14 Indicator

Part of the reason this indicator is obscure is because I think I “invented” it – but only by mashing together an indicator from Larry Williams and an indicator from Welles Wilder.  The first part is the standard Welles Wilder 14-day Relative Strength Index, more commonly referred to as “RSI”.

The 2nd part of VixRSI14 is an indicator created by famed trader Larry Williams which he dubbed “VixFix”.  This indicator is an effort to create a “Vix Index-like” indicator for any security.

AIQ TradingExpert code for these indicators appears at the end of the article.

A Few Notes

*For the record, VixRSI14 is calculated by taking a 3-day exponential average of VixFix and dividing that by a 3-day exponential average of RSI14 (are we having fun yet?).  Please see code at the end of the article.

*I prefer to use VixRSI14 using weekly data rather than daily data

*(Unfortunately) There are no “magic numbers” that indicate that a completely risk-free, you can’t lose, just buy now and watch the money roll in” buying opportunity is at hand (Disclaimer: If there was, I would probably just keep it to myself and not bother writing the article – sorry, it’s just my nature).  That being said, a decent “rule of thumb” is to look for a reading above 3.5 followed by a downside reversal.

(Click any chart below to enlarge)

With those thoughts in mind, Figure 1 displays a weekly chart of Wynn Resorts (WYNN) with the two indicators plotted separately below the bar chart.1

Figure 1 – WYNN with William’s VixFix and Wilder’s RSI 14-day (Courtesy AIQ TradingExpert)

Note that as price declines, VixFix tends to rise and RSI14 tends to fall.  VIXRSI14 essentially identifies “extremes” in the difference between these two.  Figure 2 displays WYNN with VixRSI14 plotted below the bar chart.

2

Figure 2 – WYNN with VixRSI14 (Courtesy AIQ TradingExpert)

More “examples” appear in Figures 3 through 8 below.

3

Figure 3 – AMD (Courtesy AIQ TradingExpert)

4

Figure 4 – BAC (Courtesy AIQ TradingExpert)

5

Figure 5 – DISH (Courtesy AIQ TradingExpert)

6

Figure 6 – GRMN (Courtesy AIQ TradingExpert)

7

Figure 7 – NTAP (Courtesy AIQ TradingExpert)

8

Figure 8 – YHOO (Courtesy AIQ TradingExpert)

Summary

As always, I merely present “ideas” here at JOTM.  So, do not assume from the charts above that you have found the “keys to the kingdom”.  But if used in conjunction with other confirming indicators – and remembering to employ some sort of risk control for those instances when a stock price decline fails to arrest itself even after VixRSI4 peaks above 3.5 – VixRSI14 may hold some value.

Indicator Code

EDITORS NOTE: The AIQ EDS file for Jay Kaeppel’s indicator is available to download at

Below is the code for VixFix, RSI14 and VixRSI14 from AIQ Expert Design Studio.

!#######################################

!VixFix indicator code

hivalclose is hival([close],22).

vixfix is (((hivalclose-[low])/hivalclose)*100)+50.

!#######################################

!#######################################

!RSI14 code

Define days14 27.

U14 is [close]-val([close],1).

D14 is val([close],1)-[close].

AvgU14 is ExpAvg(iff(U14&gt;0,U14,0),days14).

AvgD14 is ExpAvg(iff(D14&gt;=0,D14,0),days14).

RSI14 is 100-(100/(1+(AvgU14/AvgD14))).

!#######################################

!#######################################

!VixRSI14 code

VixRSI14 is expavg(vixfix,3)/expavg(RSI14,3).

!#######################################

Jay Kaeppel

Disclaimer:  The data presented herein were obtained from various third-party sources.  While I believe the data to be reliable, no representation is made as to, and no responsibility, warranty or liability is accepted for the accuracy or completeness of such information.  The information, opinions and ideas expressed herein are for informational and educational purposes only and do not constitute and should not be construed as investment advice, an advertisement or offering of investment advisory services, or an offer to sell or a solicitation to buy any security.

An Obscure But Useful Trend-Following Tool

Everyone has heard about trend-following.  And most traders have at least a foggy grasp of the relative pros and cons associated with trend following.  And anyone who has ever employed any type of trend-following technique is aware that they are great when there is an actual trend, but that whipsaws are inevitable.

What I am about to show you will not change these facts.  But today’s piece is just a “quickie” to highlight an obscure way to use a common indicator as a “confirmation/ denial” check when assessing the trend of a given security.  For the record, I am making no claim that this indicator generates profitably “trading signals in and of itself.  Its one of those things that – and I hate this phrase as much as you do but – should be used in conjunction with other indicators to get a good sense of the current “state of the trend” for a given security.

Nothing more, nothing less.

MACD Stretched Long

Most traders are familiar with the MACD indicator.  Originally popularized by Gerald Appel, it uses a set of moving averages to attempt to assess the trend in price (and many traders also use it to try to identify overbought or oversold situations).  Standard parameters are 9,26 and 12.  The version I use is different in several ways:

*Whereas the standard MACD generates two lines and a histogram can be drawn of the difference between the two, this version just generates one line – we will call in the trend line (catchy, no?)

*We will use parameters of 40 and 105

*One other note is that (at least according to me) this indicator is best used with weekly data.

The MACD4010501

Here is the formula for AIQ TradingExpert Expert Design Studio:

Define ss3 40.

Define L3 105.

ShortMACDMA3 is expavg([Close],ss3)*100.

LongMACDMA3 is expavg([Close],L3)*100.

MACD4010501Value is ShortMACDMA3-LongMACDMA3.

As I said this should be used with “other” indicators.  For example, one might consider the current price versus a 40-week moving average.

Standard Interpretation:

*If price is above the 40-week moving average (or if whatever other trend-following indicator you are using is bullish), AND

*The MACD4010501 is trend higher THEN

ONLY play the long side of that security

Likewise:

*If price is below the 40-week moving average (or if whatever other trend-following indicator you are using is bearish), AND

*The MACD4010501 is trend lower THEN

ONLY play the short side of that security (or at least DO NOT play the long side)

Finally, DO NOT assume that every change of trend in MACD4010501 is some sort of buy or sell signal.  Consider it only as a filter for your trades.

Some random examples appear in Figures 1 through 4 (click to enlarge any chart)

1

Figure 1 – AMZN (Courtesy AIQ TradingExpert)

2

Figure 2 – IBM (Courtesy AIQ TradingExpert)

3

Figure 3 – WMT (Courtesy AIQ TradingExpert)

4

Figure 4 – TLT (Courtesy AIQ TradingExpert)

Summary

To repeat, the proper use of this obscure version of the popular MACD indicator is as follows:

*Consider the trend of MACD4010501

*Consider one or more other trend-following indicators

*If there is bullish agreement, then apply your own shorter-term entry and exit techniques to trade the long side.

*If there is bearish agreement, then apply your own shorter-term entry and exit techniques to trade the short side (or simply stand aside).

Trade on!

Jay Kaeppel

Disclaimer:  The data presented herein were obtained from various third-party sources.  While I believe the data to be reliable, no representation is made as to, and no responsibility, warranty or liability is accepted for the accuracy or completeness of such information.  The information, opinions and ideas expressed herein are for informational and educational purposes only and do not constitute and should not be construed as investment advice, an advertisement or offering of investment advisory services, or an offer to sell or a solicitation to buy any security.