The importable EDS file based on Markos Katsanos’ article in April 2022 issue of Stocks and Commodities magazine, “Stock Market Seasonality,” can be obtained on request via email to info@TradersEdgeSystems.com. The code is also available below.
Should you sell in May, or later in the summer, or never? Is October the best reentry month? Which are the best and worst months for the stock market? And are there statistically significant seasonal patterns in the equity markets? Can we improve on a seasonal system using other technical conditions?
Code for the author’s system is set up in the AIQ code file. Figure 9 shows a summary EDS backtest of the system using the SPY ETF from 1/1/2000 to 2/17/2022.
FIGURE 9. This shows the summary EDS backtest of the system using the SPY ETF from 1/1/2000 to 2/17/2022.
!Stock Market Seasonality
!Author: Markos Katsanos, TASC April 2022
!Coded by: Richard Denning, 2/10/2022
C is [close].
C1 is valresult(C,1).
H is [high].
L is [low].
V is [volume].
Avg is (H+L+C)/3.
VIXc is TickerUDF(“VIX”,C).
VIXc1 is valresult(VIXc,1).
VIXllv is lowresult(VIXc,25).
VIXllv1 is valresult(VIXllv,1).
VIXhhv is highresult(VIXc,25).
VIXhhv1 is valresult(VIXhhv,1).
VIXDN is (VIXc1 / VIXhhv1)100. VIXUP is (VIXc1 / VIXllv1)100.
TR is max(max(C1-L,H-C1),H-L).
ATR is expavg(TR,152-1). ATR1 is valresult(ATR,1). ATRllv is highresult(ATR,25). ATRllv1 is valresult(ATRllv,1). ATRhhv is highresult(ATR,25). ATRhhv1 is valresult(ATRhhv,1). ATRDN is (ATR1 / ATRhhv1)100.
ATRUP is (ATR1 / ATRllv1)*100.
Period is 130.
Coef is 0.2.
VCoef is 2.5.
inter is ln( Avg ) – ln( valresult( Avg, 1) ).
Vinter is Sqrt(variance(inter, 30 )).
Cutoff is Coef * Vinter * C.
Vave is valresult( simpleavg( V, Period ), 1 ).
Vmax is Vave * Vcoef.
VC is Min( V, Vmax ).
MF is Avg – valresult( Avg, 1 ).
VCP is iff(MF > Cutoff, VC, iff(MF < -Cutoff, -VC, 0 )).
VFI1 is Sum( VCP, Period ) / Vave.
VFI is expavg( VFI1, 3 ).
SELLMONTH is 8.
VIXUPMAX is 60.
CRIT is -20. !VFI SELL
K is 1.5. !ATR/VIX RATIO
VOLCONDITION is (VIXUPCRIT.
BUY if (Month()>=10 OR Month()2*VIXUPMAX. !VOLATILITY EXIT
SELLMF if CRIT > VFI AND valrule(CRIT < VFI,1) AND simpleavg(VFI,10)<valresult(simpleavg(VFI,10),1).
Sell if SELLSEASONAL OR valrule(SELLVOLATILITY,1) OR valrule(SELLMF,1).
for AIQ Systems