Subject: Re: NDX 100 Momentum Strategy - Code Repository
Not that anybody cares, or maybe it's just me being difficult (per wife) or pedantic (per me) but ...
SMA 325 vs. the more standard 200 smells like data-dredging. But, whatevver, 10 months, 12 months, 15 months, 200 days, 43 weeks .... you could make an argument for any of them.
OMG! I looked at the BCC definition and got dizzy
"lf-1lp-1h1::BCC:gt0:SMADiff:imports(0,SMADiff,1,0):NHNLRatio:imports(1,NHNLRatio,1,0):BCIII:imports(2,BCIII,1,0):BCC:linear(1,ifgt(SMADiff,0,1,0),2,ifgt(NHNLRatio,1,1,0),4,BCIII){lf-1lp-1h1::SMADiff:gt0:SMADiff:linear(1,sma(1,200),-1,sma(11,200)){U:{!GSPC}}}{lf-1lp-1h1::iflt(linear(1,ord(1),-1,date2ord(19731217)),0,3,excd.a)et3:styp.a:et10!11!18!48:dspo(1)al252:NHNLRatio:et-1:CountOfHighs:sum(ifgt(ratio(gprc(1),hgprc(2,251)),1,1,0),1,step3):CountOfLows:sum(iflt(ratio(gprc(1),lgprc(2,251)),1,1,0),1,step3):WeightedCountOfHighs:sgwsum(CountOfHighs,0,9,8,7,6,5,4,3,2,1):WeightedCountOfLows:sgwsum(CountOfLows,0,9,8,7,6,5,4,3,2,1):NHNLRatio:ratio(WeightedCountOfHighs,WeightedCountOfLows)}{lf-1lp-1h1::BCIII:et1:BCIII:sgmax(ifgt(ratio(gprc(1),hgprc(2,98)),1,1,0),0,99){U:{!GSPC}}}{U:{lf-1lp-1h1::pref(sp500.a,sp90.a)et1:rank(class.a,permco.a,step1)et1:MktCapWt:gt0:MktCapWt:product(aprc,ifet(styp.a,30!31,sho.a,cso.a)):wtf:MktCapWt}}"
That looks kind of like what we used to write as a complicated TECO expression. "Write-only code" Heh.
Timing
If you turn off the timing ("BCC = 99999") you get CAGR 25.1% vs. 26.7% and GSD 36% vs. 33%. Not a great lot of difference.
I hate to overburden a backtester to try to jam some sort of timing into it. Plus my favorite timing strategy (GTT*) isn't done in any backtester. Probably can't be. Also I'm a complete GTR1 neophyte.
The above BCC is so complex I would have ZERO confidence in it.
What I do is check "[x] Portfolio Values: Download daily portfolio values" to create a spreadsheet. I have another program that spits out daily/weekly/monthly timing signals, which I insert into the same spreadsheet and then apply those signals to the GTR1 values. Actually I compute the daily/weekly/monthly returns from the values, and then use either that or 0% (i.e., cash) as the timed period return.
That's a bit of fiddly work, so I don't do it unless the strategy looks pretty good even without timing.
Actually I lie. For a Nasdaq 100 screen I use Jim's "QQQ, no new 90 day high in the last 90 days" for timing. That seems to work better than S&P500 timing.
* GTT = growth and trend timing, which uses two FRED indexes of the economy to gate the SMA sell signal.