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 info@TradersEdgeSystems.com. 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

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

!FORMULAS
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
info@TradersEdgeSystems.com
for AIQ Systems