AIQ code based on Markos Katsanos’s article in the October issue of Stocks & Commodities issue, “A Low-Risk ETF Trading Strategy,” is provided in a downloadable code file, available on request from rdencpa@gmail.com. The code is also shown here.
The strategy combines two complementary concepts: Wilder’s relative strength index (RSI) to identify ETFs that have recently declined and may be emerging from a short-term oversold condition, and a custom relative strength indicator to narrow the selection to
Using the EDS file, the trading strategy described in Katsanos’ article can be run. The file needs to be run using a list of only ETFs. I tried the list supplied by the author as well as a longer list. Both lists performed about the same.
! A low-Risk ETF Trading Strategy, TASC Oct 2026
! Author: Markos Katsanos
! Coded by: Richard Denning, 08/11/2026
!ABBREVIATIONS:
C is [close].
V is [volume].
!INPUTS:
timeExit is 30.
RSBARS is 35.
RSCRIT is 3.
MAR is 50.
RSIBARS is 10.
MABARS is 15.
RSIOS is 35.
CORMIN is 0.6.
PRFTGT is 25.
MinVol is 100000.
!INDICATORS:
!RSMK:
IND is tickerUDF("SPY",C).
RS is ln(C/IND) - ln(valresult(C/IND,RSBARS)).
RSMK is expavg(RS,4)*100.
!RSI:
U is C-valresult(C,1).
D is valresult(C,1)-C.
L1 is 2 * RSIBARS - 1.
AvgU is ExpAvg(iff(U>0,U,0),L1).
AvgD is ExpAvg(iff(D>=0,D,0),L1).
RSI is 100-(100/(1+(AvgU/AvgD))).
!ROC:
ROC is (C / valresult(C,6) - 1).
RSMKavg is simpleavg(RSMK,MAR).
hiRSMK is highresult(RSMK,3,1).
SPYroc is tickerUDF("SPY",ROC).
!PEARSON CORRELATION:
N is 100.
! 1 BAR RETURNS
rC is (C / val([close],1) - 1).
SPYc is TickerUDF("SPY",C).
SPYrc is (SPYc / valresult(SPYc,1) - 1).
! MEANS
meanX is simpleavg(rC,N).
meanY is simpleavg(SPYrc,N).
! STANDARD DEVIATIONS
stdDx is sqrt(variance(rC,N)).
stdDy is sqrt(variance(SPYrc,N)).
! COVARIANCE
covXY is simpleavg((rC - meanX) * (SPYrc - meanY),N).
! PEARSON CORRELATION
r is covXY / (stdDx * stdDy).
!ENTRY CONDITIONS:
con1 if simpleavg(V,5) > MinVol.
con2 if RSMK > RSMKavg.
con3 if RSMK > RSCRIT.
con4 if RSMK > highresult(RSMK,3,1).
con5 if RSMK < 25.
con6 if (tickerUDF("SPY",ROC) > -6 and r > CORMIN)
or (tickerUDF("SPY",ROC) < -6 and r < -CORMIN).
LLVrsi is lowresult(RSI,20) .
con7 if lowresult(RSI,20) < RSIOS.
HHVrsi_1 is highresult(RSI,2,1).
con8 if RSI > highresult(RSI,2,1).
esa5 is expavg(C,5).
sma15_5 is valresult(simpleavg(C,MABARS),5).
con9 if expavg(C,5) > valresult(simpleavg(C,MABARS),5).
!EXIT CONDITIONS:
ex1 if RSMK < -RSCRIT and r > 0.8.
ex2 if {Position days} >= timeExit.
ex3 if (C / {Position Entry Price} -1) >= 0.25.
!ENTRY RULE:
Buy if con1 and con2 and con3 and con4 and con5
and con6 and con7 and con8 and con9.
!EXIT RULE:
Sell if ex1 or ex2 or ex3.

FIGURE 4: AIQ. This shows a summary EDS report as of 4/22/2026, when there were buy signals on QQQ and XLK.

FIGURE 5: AIQ. This demonstrates a recent trade on QQQ with entry on 4/23/2026 (the next day at the open after the buy signal was generated) and an exit on 6/05/2026 (the next day after the exit signal was generated).
—Richard Denning
For AIQ Systems
rdencpa@gmail.com