Hi, Shrewd!        Login  
Shrewd'm.com 
A merry & shrewd investing community
Best Of MIBest OfAll BoardsThe Shrewd’m WeeklyLearn to InvestHow to Become Shrewd
Search
Shrewd'm.com Merry shrewd investors
Search
Best Of MIBest OfAll BoardsThe Shrewd’m WeeklyLearn to InvestHow to Become Shrewd


The week's question
In March 2025, in the thread "Re: OT, out", Umm asked the members: "Do you think it is because America is made up of magical soil that makes businesses based in America magically profitable?" This week it is put to everyone again. The button below opens the small thread re-asking it - read what others have said so far, then give your own answer as an ordinary reply.
Answer this questionContinue to Shrewd'mThis note won't appear again
Investment Strategies / Mechanical Investing
Unthreaded | Threaded | Whole Thread (70) |
Author: rayvt ✧☼🐝🐝  😊 😞
Number: of 6243 
Subject: Re: NDX 100 Momentum Strategy - Code Repository
Date: 03/04/26 4:26 PM
Post New | Post Reply | Report Post | Recommend It!
No. of Recommendations: 4
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.





Post New | Post Reply | Report Post | Recommend It!
Print the post
Members reply directly to rayvt here — and replies get answered. Reading is free; so is joining the conversation. Join Shrewd'm »
This community has written 6,227 posts about Mechanical Investing. The article-length ones it recommended most:
Dividend investing · 52 recs · 2025
Non-Mag7 screen · 34 recs · 2025
OT - Div yields and returns · 32 recs · 2024
Using AI to generate backtesting programs · 30 recs · 2025
Rankings for 19Dec2022 · 29 recs · 2022
Unthreaded | Threaded | Whole Thread (70) |


Announcements
Mechanical Investing FAQ
Contact Shrewd'm
Contact the developer of these message boards.

Best Of MI | Best Of | Favourites & Replies | All Boards | Followed Shrewds | Open Questions | Moving a community