Category Archives: technical indicator

Trend Strength: Measuring The Duration Of A Trend

The importable AIQ EDS file based on Richard Poster’s article in February 2021 issue, of Stocks & Commodities “Trend Strength: Measuring The Duration Of A Trend,” Getting a good reading on trend strength is an important and useful metric to have when trading. Here, we introduce a new technique that makes use of a less common approach to measuring the strength of a trend… can be obtained on request via email to The code is also shown here:

!Trend Strength: Measuring The Duratioin of A Trend !Author: Richard Poster, TASC Feb 2021 
!Coded by: Richard Denning 12/12/2020
TPRlen is 20.
SMAlen is 5.
ThrshFixed is 1.0.
MULT is 10.
C is [close]. _point is 0.01.

sma1 is simpleavg(C,SMAlen,0).
sma2 is simpleavg(C,SMAlen,1).
smadiff is (sma1 - sma2)/(MULT*_point).
up if smadiff>ThrshFixed.
dn if smadiff<-ThrshFixed.
countP is countof(up,TPRlen).
countM is countof(dn,TPRlen).
tpr is abs(100*(countP-countM)/TPRlen).
ListValues if 1.

Code for the TPR indicator is set up in the AIQ code file for stocks with point value equal to 0.01. Figure 7 shows the indicator on a chart of Apple Inc. (AAPL).

Sample Chart
FIGURE 7: AIQ. The TPR indicator is shown on a chart of Apple Inc. (AAPL).

—Richard Denning
for AIQ Systems

The RS4r: Tracking Relative Strength In Four Dimensions

Relative strength has more information embedded within it than meets the eye. Here is a way to identify and compress several dimensions of relative strength into one single scalable value, the RS4r, which allows you to compare and then rank securities for robustness across timeframes and shifting market conditions…

The importable AIQ EDS file based on James Garofallou’s article in
Stocks & Commodities magazine September 2020 issue, “The RS4r: Tracking Relative Strength In Four Dimensions,” can be obtained on request via email to The code is also available here:

! The RS4r: Tracking Relative Strength in Four Dimensions
! Author: James Garofallou, PhD, TASC Sept 2020
! Coded by: Richard Denning, 7/18/2020

C is [close].
len1 is 10.
len2 is 15.
NumIndx is 4.
BuyLvl is 80.

SPYc is TickerUDF("SPY",C).      !SP500
QQQc is TickerUDF("QQQ",C).     !NASDAQ100
MDYc is TickerUDF("MDY",C).     !SP400
IWMc is TickerUDF("IWM",C).      !Russel2000

RS1spy is C/SPYc.
RS1qqq is C/QQQc.
RS1mdy is C/MDYc.
RS1iwm is C/IWMc.

FastSPY is Expavg(RS1spy,len1).
MedSPY is Simpleavg(FastSPY,7).
SlowSPY is Simpleavg(FastSPY,15).
VSlowSPY is Simpleavg(SlowSPY,30).

FastQQQ is Expavg(RS1qqq,Len1).
MedQQQ is Simpleavg(FastQQQ,7).
SlowQQQ is Simpleavg(FastQQQ,15).
VSlowQQQ is Simpleavg(SlowQQQ,30).

FastMDY is Expavg(RS1mdy,Len1).
MedMDY is Simpleavg(FastMDY,7).
SlowMDY is Simpleavg(FastMDY,15).
VSlowMDY is Simpleavg(SlowMDY,30).

FastIWM is Expavg(RS1iwm,Len1).
MedIWM is Simpleavg(FastIWM,7).
SlowIWM is Simpleavg(FastIWM,15).
VSlowIWM is Simpleavg(SlowIWM,30).

Tier1spy is iff(FastSPY>=MedSPY and MedSPY>=SlowSPY and SlowSPY>=VslowSPY,10,0).
Tier1qqq is iff(FastQQQ>=MedQQQ and MedQQQ>=SlowQQQ and SlowQQQ>=VslowQQQ,10,0).
Tier1mdy is iff(FastMDY>=MedMDY and MedMDY>=SlowMDY and SlowMDY>=VslowMDY,10,0).
Tier1iwm is iff(FastIWM>=MedIWM and MedIWM>=SlowIWM and SlowIWM>=VslowIWM,10,0).

Tier2spy is iff(FastSPY>=MedSPY and MedSPY>=SlowSPY and SlowSPY<VslowSPY,9,0).
Tier2qqq is iff(FastQQQ>=MedQQQ and MedQQQ>=SlowQQQ and SlowQQQ<VslowQQQ,9,0).
Tier2mdy is iff(FastMDY>=MedMDY and MedMDY>=SlowMDY and SlowMDY<VslowMDY,9,0).
Tier2iwm is iff(FastIWM>=MedIWM and MedIWM>=SlowIWM and SlowIWM<VslowIWM,9,0).

Tier3spy is iff(FastSPY<MedSPY and MedSPY>=SlowSPY and SlowSPY>=VslowSPY,9,0).
Tier3qqq is iff(FastQQQ<MedQQQ and MedQQQ>=SlowQQQ and SlowQQQ>=VslowQQQ,9,0).
Tier3mdy is iff(FastMDY<MedMDY and MedMDY>=SlowMDY and SlowMDY>=VslowMDY,9,0).
Tier3iwm is iff(FastIWM<MedIWM and MedIWM>=SlowIWM and SlowIWM>=VslowIWM,9,0).

Tier4spy is iff(FastSPY<MedSPY and MedSPY>=SlowSPY and SlowSPY<VslowSPY,5,0).
Tier4qqq is iff(FastQQQ<MedQQQ and MedQQQ>=SlowQQQ and SlowQQQ<VslowQQQ,5,0).
Tier4mdy is iff(FastMDY<MedMDY and MedMDY>=SlowMDY and SlowMDY<VslowMDY,5,0).
Tier4iwm is iff(FastIWM<MedIWM and MedIWM>=SlowIWM and SlowIWM<VslowIWM,5,0).

RS2spy is Tier1spy + Tier2spy + Tier3spy + Tier4spy.
RS2qqq is Tier1qqq + Tier2qqq + Tier3qqq + Tier4qqq.
RS2mdy is Tier1mdy + Tier2mdy + Tier3mdy + Tier4mdy.
RS2iwm is Tier1iwm + Tier2iwm + Tier3iwm + Tier4iwm.

RS3x is  (RS2spy+RS2qqq+RS2mdy+RS2iwm).

RS4 is (RS3x/NumIndx)*10.
RS4osc is simpleavg(RS4,3).
mvSig is simpleavg(RS4osc,5).
RS4r is round(RS4).

mvRS4 is expavg(RS4r,4).
RS4up is iff(RS4r >= 80 or RS4r > mvRS4,1,0).

X is iff(RS4 >= 80,1,0).
R5 is iff(RS4up =1,round(simpleavg(X,len2)*100),0).

Buy if R5 >= BuyLvl.
ExitBuy if R5 < BuyLvl.

ShowValues if 1.

Code for the RS4r is included in the EDS file. I also coded a system that uses the RS4r (R5). I used four independent ETFs as indexes rather than the 11 mutual funds that the author used. I used SPY, QQQQ, MDY, and IWM. The trading system buys (long only) when the R5 >= 80 and exits the long position when RS4r < 80. The summary EDS backtest report for trading this system on the Nasdaq 100 stocks (commission & slippage not subtracted) is shown in Figure 13 and a sample trade on DISH with the R5 indicator is shown in Figure 12.

Sample Chart

FIGURE 12: AIQ. Chart of DISH with R5 indicator and sample trade using R5 indicator >= 80 to buy.

Sample Chart

FIGURE 13: AIQ. Summary EDS backtest report for the R5 system that trades the Nasdaq 100 stocks over the last 4 years.

—Richard Denning
for AIQ Systems

Good Companies, Troubled Stocks and Potential Opportunity

Truth be told I am not much of a “stock picker”. Oh, I can pick ‘em alright just like anyone else.  They just to don’t go the right way as often as I’d like.  I also believe that the way to maximize profitability is to follow a momentum type approach that identifies stocks that are performing well and buying them when they breakout to the upside (ala O’Neil, Minervini, Zanger, etc.) and then riding them as long as they continue to perform.  Unfortunately, I’m just not very good at it. 

Back when I started out, there was such a thing as a “long-term investor.”  People would try to find good companies selling at a decent price and they would buy them and hold them for, well, the long-term.  Crazy talk, right? As I have already stated, I am not claiming that that is a better approach. I am just pointing out that it was “a thing.”

An Indicator

There is an indicator (I will call it VFAA, which is short for vixfixaverageave, which – lets face it – is a terrible name) that I follow that was developed as an extension of Larry William’s VixFix Indicator.  There is nothing magic about it.  Its purpose is to identify when price has reached an exceptionally oversold level and “may” be due to rally.  The code for this indicator appears later.

For the record, I DO NOT systematically use this indicator in the manner I am about to describe, nor am I recommending that you do.  Still, it seems to have some potential value, so what follows is merely an illustration for informational purposes only.

The Rules

*We will look at a monthly bar chart for a given stock

*A “buy signal” occurs when VFAA reaches or exceeds 80 and then turns down for one month

*A “sell (or exit) signal” occurs when VFAA subsequently rises by at least 0.25 from a monthly closing low

Seeing as how this is based solely on monthly closes it obviously this is not going to be a “precision market timing tool.”

Some “Good Companies” with “Troubled Stocks”

So now let’s apply this VFAA indicator to some actual stocks.  Again, I AM NOT recommending that anyone use this approach mechanically.  The real goal is merely to try to identify situations where a stock has been washed out, reversed and MAY be ready to run for a while.

Ticker BA

Figure 1 displays a monthly chart for Boeing (BA) with VFAA at the bottom.  The numbers on the chart represent the hypothetical + (-) % achieved by applying the rules above (although once again, to be clear I am not necessarily suggesting anyone use it exactly this way). 

Figure 1 – Ticker BA with VFAA (Courtesy AIQ TradingExpert)

From March 2019 into March 2020 BA declined -80%.  It has since bounced around and VFAA has soared to 110.88.  VFAA has yet to rollover on a month-end basis, so nothing to do here except exhibit – what’s that word again – oh right, “patience.”

Ticker GD

Figure 2 displays a monthly chart for General Dynamics (GD) with VFAA at the bottom. 

Figure 2 – Ticker GD with VFAA (Courtesy AIQ TradingExpert)

Are these “world-beating numbers”?  Not really.  But in terms of helping to identify potential opportunities, not so bad. VFAA gave a “buy signal” for GD at the end of July. So far, not so good as the stock is down about -6%.

Ticker WFC

Figure 3 displays a monthly chart for Wells Fargo (WFC) with VFAA at the bottom. 

Figure 3 – Ticker WFC with VFAA (Courtesy AIQ TradingExpert)

There are not many “signals” but the ones that occurred have been useful. Between 2018 and 2020 WFC declined -65%.  It has since bounced around and VFAA has soared to 102.44.  VFAA has yet to rollover on a month-end basis. But at some point it will, and a potential opportunity may arise.

VFAA Formula

Below is the code for VFAA

VixFix is an indicator developed many years ago by Larry Williams which essentially compares the latest low to the highest close in the latest 22 periods (then divides the difference by the highest close in the latest 22 periods).  I then multiply this result by 100 and add 50 to get VixFix.

*Next is a 3-period exponential average of VixFix

*Then VFAA is arrived at by calculating a 7-period exponential average of the previous result (essentially, we are “double-smoothing” VixFix)

Are we having fun yet?  See code below:

hivalclose is hival([close],22).

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

vixfixaverage is Expavg(vixfix,3).

vixfixaverageave is Expavg(vixfixaverage,7).

VFAA = vixfixaverageave

EDITORS NOTE: The AIQ Expert Design Studio code for the indicator is available to download from here. Save this file to your /wintes32/EDS Strategies folder


One thing to note is that VFAA “signals” on a monthly chart don’t come around very often.  So, you can’t really sit around and wait for a signal to form on your “favorite company”.  You have to look for opportunity wherever it might exist.

One last time let me reiterate that I am not suggesting using VFAA as a standalone systematic approach to investing. But when a signal does occur – especially when applied to quality companies that have recently been “whacked”, it can help to identify a potential opportunity.

Jay Kaeppel

Disclaimer: The information, opinions and ideas expressed herein are for informational and educational purposes only and are based on research conducted and presented solely by the author.  The information presented represents the views of the author only and does not constitute a complete description of any investment service.  In addition, nothing presented herein should be construed as investment advice, as an advertisement or offering of investment advisory services, or as an offer to sell or a solicitation to buy any security.  The data presented herein were obtained from various third-party sources.  While the data is believed 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.  International investments are subject to additional risks such as currency fluctuations, political instability and the potential for illiquid markets.  Past performance is no guarantee of future results.  There is risk of loss in all trading.  Back tested performance does not represent actual performance and should not be interpreted as an indication of such performance.  Also, back tested performance results have certain inherent limitations and differs from actual performance because it is achieved with the benefit of hindsight.

Quick Market update video

The Expert System in TradingExpert Pro gave a 1 – 99 down signal on the Dow Jones on 8-27-20. The market internals based on the advancing vs declining issue in the New York market continue to diverge from the market price action.

The phase indicator used to confirm Expert Ratings turned down on 8-31-20. We usually look for a phase confirmation of an Expert Rating to occur within 3 days of the rating.

The changes made in the constituents of the Dow 30 effective 8-31-20

  • replaced Exxon Mobil, Amgen replacedd Pfizer and Honeywell replaced Raytheon Technologies.
  • The changes were due to Apple’s 4-for-1 stock split, which significantly reduced the indexes exposure to the information technology sector.
  • The Dow 30 is a price weighted index.

Dow 30 MACD picture – Dotcom vs Covid

You may have seen some of the articles out there analyzing the skewed nature of the current market rally. As Joe Bartosiewicz in his August 8 Bartometer pointed out:

“The Top 15 Stocks in the S&P 500 account in Market Value 35% of the entire S&P 500 stock market. The Bottom 420 Stocks in the S&P 500 account in Market Value 33.8% of the entire S&P 500 stock market. This means that 15 stocks are controlling the entire S&P 500..”

The Dow Jones 30 index uses a price weighted criteria as part of it’s calculation, and also includes Apple; AAPL has more than doubled in price in under 5 months.

Given that there appears to be only a small basket of stocks leading this rally, we had a look back at the last time tech related stocks were driving the market higher; the dotcom bubble that ran through the 90s into the early 00s.

Monthly DJIA and MACD – left through 3/2002 – right through 10/2002

The first chart is a monthly of the Dow 30 with MACD indicator comparing the market 03/29//2002 as the dotcom bubble rolled over vs 7 months later. Students of divergence analysis, will tell you that MACD in late March 2002 clearly showed prices should be much lower still despite the @33 % rally from the September 2001 low. By late October 2002 the market had fallen again by @33%. At that time the market was close to @40% lower than the high at the start of 2000.

Monthly DJIA and MACD – left through 3/2002 – right through 8/2020

The second chart is a monthly of the Dow 30 on the right through 8/10/20 vs the rally peak of 03/29/2002. The current market has had a @50% rally from the low at the end of March 2020. The original correction was @37% from high to low, slightly bigger than the dotcom correction. The MACD, similar to 2002, is strongly diverging.

The decline in 2002, after the rally, took prices lower than the the prior bottom. If a similar pattern happens this time and the decline is @40% from the high of 29568, the Dow would at the 17700 level.