Nils W
banner
optionstocksmachines.com
Nils W
@optionstocksmachines.com
Options, stocks, machines: Driven by data, Tamed by Python and R
https://www.optionstocksmachines.com/
Helping coders invest, and investors code

𝗕𝗢𝗧𝗪 𝟮𝟱: 𝗥𝗼𝗯𝗼𝘁𝘀 𝘁𝗼 𝘁𝗵𝗲 𝗥𝗲𝘀𝗰𝘂𝗲: New backtest inspired by Robot Wealth. Go long the bottom half performing S&P sector ETFs from the first half of the month and hold until the end of the month. Risk-adjusted returns exceed SPY for time in the market.

optionstocksmachines.substack.com/p/botw-25-ro...
BOTW 25: Robots to the Rescue
Exploiting potential rebalancing candidates among the S&P sector ETFs produces nice risk-adjusted outperformance
optionstocksmachines.substack.com
December 12, 2025 at 2:24 PM
𝗕𝗢𝗧𝗪 𝟭𝟲: 𝗢𝗶𝗹 𝘃𝘀. 𝗢𝗶𝗹 Pairs trading big oil companies vs. oil the commodity significantly outperforms XLE and the S&P. But a missing component could alter results meaningfully. Stay tuned for the reveal in our next post!

optionstocksmachines.substack.com/p/botw-16-oi...
BOTW 16: Oil vs. Oil
Pairs trading big oil companies Exxon or Chevron vs. oil significantly outperforms XLE and the S&P.
optionstocksmachines.substack.com
June 14, 2025 at 6:02 PM
𝗛𝗙𝗪 𝟭𝟵: 𝗔𝘂𝘁𝗼𝗺𝗮𝘁𝗲 𝗘𝗧𝗦 We compare an additive ETS model against an AutoETS one on Apple's revenues. Forecast errors meaningfully lower for AutoETS. Warrants optimism around AutoETS performance when we test it on the full dataset. Stay tuned!
optionstocksmachines.substack.com/p/hfw-19-aut...
HFW 19: Automate ETS
AutoETS improves forecasts meaningfully vs. ETS on Apple
optionstocksmachines.substack.com
June 10, 2025 at 11:21 PM
optionstocksmachines.substack.com/p/botw-15-ey... Recently, while private credit has become investable for individual investors, it hasn't always been. We take a crack at isolating returns to the asset over a 10-year period in recent backtest.

optionstocksmachines.substack.com/p/botw-15-ey...
June 8, 2025 at 7:35 PM
𝗛𝗙𝗪 𝟭𝟴: 𝗔𝗱𝗱𝗶𝗻𝗴 𝘁𝗵𝗲 𝗘 𝘁𝗼 𝗘𝗧𝗦 Adding an error term to the exponential smoothing models we use to forecast revenues on our S&P 500 sector dataset improves performance modestly. This sets up nicely to introduce AutoETS in future posts. Stay tuned!
optionstocksmachines.substack.com/p/hfw-18-add...
HFW 18: Adding the E to ETS
Adding an error term to our exponential smoothing trend and seasonality models produces modestly better performance than without the term
optionstocksmachines.substack.com
June 4, 2025 at 12:55 PM
𝗕𝗢𝗧𝗪 𝟭𝟰: 𝗦𝘆𝘀𝘁𝗲𝗺𝗮𝘁𝗶𝗰 𝗙𝗮𝗰𝘁𝗼𝗿𝘀 We take a breather from the rarefied air of dividend aristocrats to wade in on factor investing for our weekly backtest. A long/short portfolio created by ranking factor ETFs using rolling Sharpe Ratios beats the market.

optionstocksmachines.substack.com/p/botw-14-sy...
BOTW 14: Systematic Factors
A long/short portfolio created by ranking factor ETFs using rolling Sharpe Ratios beats the market.
optionstocksmachines.substack.com
May 21, 2025 at 8:12 PM
𝗛𝗙𝗪 𝟭𝟳: 𝗦𝗺𝗼𝗼𝘁𝗵 𝗧𝗿𝗲𝗻𝗱𝘀 Exponential smoothing with trend and seasonality performs as well as simple smoothing but with more realistic forecast graphs, a key enhancement for stakeholders that need such details. More enhancements to follow. Stay tuned!

optionstocksmachines.substack.com/p/hfw-17-smo...
HFW 17: Smooth Trends
Exponential smoothing with trend and seasonality performs as well as simple smoothing but with more realistic forecast graphs
optionstocksmachines.substack.com
May 19, 2025 at 3:33 PM
𝗕𝗢𝗧𝗪 𝟭𝟯: 𝗗𝗼𝗴𝗴𝗶𝗲 𝗗𝗲𝘂𝘅 More Dogs of the Dow with a Twist! Long-short strategy on the top and bottom deciles by dividend yield outperforms by over 50% pts vs benchmark. Second from the top and bottom underperforms by about 10% pts. Real doggie deux!

optionstocksmachines.substack.com/p/botw-13-do...
BOTW 13: Doggie Deux
Using deciles instead of a top 10 ranking improves our Aristocratic Dog strategy by 10 percentage points.
optionstocksmachines.substack.com
May 14, 2025 at 3:39 PM
𝗛𝗙𝗪 𝟭𝟲: 𝗦𝗺𝗼𝗼𝘁𝗵 𝗘𝘅𝗽𝗼𝗻𝗲𝗻𝘁𝗶𝗮𝗹𝗲𝗿 Simple exponential smoothing outperforms the benchmarks on our S&P 500 revenue dataset. But the model produces flat forecasts just like the naïve one. We'll resolve that issue in our next post. Stay tuned!

optionstocksmachines.substack.com/p/hfw-16-smo...
HFW 16: Smooth Exponentialer
Simple exponential smoothing yields the best performance thus far
optionstocksmachines.substack.com
May 12, 2025 at 5:40 PM
𝗕𝗢𝗧𝗪 𝟭𝟮: 𝗔𝗿𝗶𝘀𝘁𝗼𝗰𝗿𝗮𝘁𝗶𝗰 𝗗𝗼𝗴𝘀 Not King Charles Spaniels or the new Tarantino movie. Applying the Dogs of the Dow strategy to the Dividend Aristocrats. Results are impressive. Beats the benchmark by almost 40% pts. Quality investing for quants!
optionstocksmachines.substack.com/p/botw-12-ar...
BOTW 12: Aristocratic Dogs
Applying the Dogs of the Dow methodology to Dividend Aristocrats yields significant outperformance relative to the benchmark
optionstocksmachines.substack.com
May 8, 2025 at 5:40 PM
𝗕𝗢𝗧𝗪 𝟭𝟭: 𝗖𝗿𝗲𝗱𝗶𝘁 𝗦𝗽𝗿𝗲𝗮𝗱 𝗔𝗿𝗯𝗶𝘁𝗿𝗮𝗴𝗲 Continuing our fixed income theme, a pairs trading strategy using the ETFs LQD and HYG generates a Sharpe Ratio 20% better than an equivalent 50-50 benchmark. More fixed income backtests to follow. Stay tuned!
optionstocksmachines.substack.com/p/botw-11-cr...
BOTW 11: Credit Spread Arbitrage
A pairs trading strategy using the ETFs LQD and HYG generates a Sharpe Ratio 20% better than an equivalent 50-50 benchmark on the same ETFs
optionstocksmachines.substack.com
April 30, 2025 at 5:25 PM
𝗛𝗙𝗪 𝟭𝟰: 𝗚𝗔𝗥𝗖𝗛 𝗖𝘂𝗿𝗶𝗼𝘂𝘀 Key takeaway: G/ARCH models beat most models examined to date in our Hello Forecasting World series. But the naïve and autoregressive growth rate models remain at the top. Simplicity wins the day, again!

optionstocksmachines.substack.com/p/hfw-14-gar...
HFW 14: GARCH Curious
G/ARCH models perform better than most models examined to date. But our time series are probably not sufficiently long to allow these models to shine.
optionstocksmachines.substack.com
April 28, 2025 at 6:41 PM
𝗕𝗢𝗧𝗪 𝟭𝟬: 𝗠𝗕𝗦 𝗳𝗼𝗿 𝗙𝘂𝗻 𝗮𝗻𝗱 𝗣𝗿𝗼𝗳𝗶𝘁 We pair two MBS ETFs, MBB and MTBA. The strategy outperforms nicely, and, generates a Sharpe Ratio double the benchmark. Leverage warranted and while remaining market neutral.
optionstocksmachines.substack.com/p/botw-10-mb...
BOTW 10: MBS for Fun and Profit
Pairs trading MTBA vs. MBB, the MBS ETFs, generates tidy risk-adjusted outperformance with or without leverage
optionstocksmachines.substack.com
April 23, 2025 at 8:50 PM
𝗛𝗙𝗪 𝟭𝟯: 𝗔𝗥𝗖𝗛 𝗖𝗼𝗺𝗽𝗹𝗲𝘅 Addressing volatility in S&P 500 revenue dataset with a basic ARCH model. Bottom line: ARCH beats most others to date apart from the benchmarks. Performs the best on the tech ETF, XLK, More knobs to tune performance!
optionstocksmachines.substack.com/p/hfw-13-arc...
HFW 13: ARCH Complex
A basic ARCH model performs better than most of the previous models, but is modestly worse than the naïve and autoregressive growth rate models
optionstocksmachines.substack.com
April 21, 2025 at 5:39 PM
𝗥𝗲𝗰𝗲𝘀𝘀𝗶𝗼𝗻 𝗜𝗻𝗱𝗶𝗰𝗮𝘁𝗼𝗿𝘀: 𝗦𝗮𝗵𝗺 𝗥𝘂𝗹𝗲 𝗜 Key finding: though not a forecasting tool, the rule does not suffer from the same type of false positives one sees in yield spreads. Our next post will compare the rule to stock market action. Stay tuned!

optionstocksmachines.substack.com/p/recession-...
Recession indicators: Sahm Rule I
Not a forecasting tool, but no false positives like yield spreads
optionstocksmachines.substack.com
April 16, 2025 at 8:12 PM
𝗛𝗙𝗪 𝟭𝟮: 𝗔𝗥𝗠𝗔 𝗮𝗱𝗱𝘀 𝗹𝗶𝘁𝘁𝗹𝗲 𝗮𝗴𝗮𝗶𝗻 Adding a moving average component does little for performance. But the model does perform better than all the previous ones apart the benchmarks. Time to move on to incorporating volatility into our models. Stay tuned!
optionstocksmachines.substack.com/p/hfw-12-arm...
HFW 12: ARMA adds little again
An ARMA(1,1) model using growth rates performs modestly worse than the AR(1) model, but still better than most of the prior models we've tested thus far
optionstocksmachines.substack.com
April 14, 2025 at 7:15 PM
𝗕𝗢𝗧𝗪 𝟴: 𝗥𝗼𝗹𝗹𝗶𝗻𝗴 𝘄𝗶𝘁𝗵 𝗔𝗔𝗜𝗜: Rolling regression for the win. We build several rolling regression models, rank them, and then satisfice, rather than optimize. The resulting outperformance on the validation set exceeds 30% points!
optionstocksmachines.substack.com/p/botw-8-rol...
BOTW 8: Rolling with AAII
Rolling regression on AAII signals improves strategy results meaningfully
optionstocksmachines.substack.com
April 11, 2025 at 8:14 PM
𝗛𝗙𝗪 𝟭𝟭: 𝗔𝘂𝘁𝗼𝗿𝗲𝗴𝗿𝗲𝘀𝘀𝗶𝘃𝗲 𝗴𝗿𝗼𝘄𝘁𝗵 𝗿𝗮𝘁𝗲𝘀 An AR(1) model using growth rates surpasses the major algorithms we've examined thus far, and is also tiny bit better than the naïve model. Next up we'll see if we can improve upon this performance. Stay tuned!
optionstocksmachines.substack.com/p/hfw-11-aut...
HFW 11: Autoregressive growth rates
An AR(1) model using sequential growth rates takes the title from the naïve model for best performance on our S&P dataset
optionstocksmachines.substack.com
April 9, 2025 at 6:31 PM
𝗧𝗵𝗲 𝟮𝟬𝟬-𝗪𝗲𝗲𝗸 Wall St. strategists are saying the S&P might find support at the 200-Week Moving Average. Classic data analysis shows one-month to one-year returns after a dip below tend to be positive.
optionstocksmachines.substack.com/p/the-200-week
The 200-Week
Empirical probabilities suggest the best risk-reward comes in the 6-month period after the S&P 500 dips below the 200-Week moving average
optionstocksmachines.substack.com
April 7, 2025 at 7:08 PM
𝗕𝗢𝗧𝗪 𝟳: 𝗠𝗼𝗺𝗲𝗻𝘁𝘂𝗺 𝗼𝗳 𝗺𝗼𝗺𝗲𝗻𝘁𝘂𝗺 Pairing the S&P momentum ETF against the covered call variant produces over 50 percentage points of cumulative outperformance vs. the benchmark. Definitely an attractive proof-of-concept. Stay tuned!
optionstocksmachines.substack.com/p/botw-7-mom...
BOTW 7: Momentum of momentum
A pairs strategy using momentum as a signal on momentum and covered call ETFs produces attractive outperformance vs. the benchmark
optionstocksmachines.substack.com
April 4, 2025 at 7:48 PM
𝗜𝗻𝘁𝗿𝗮𝗱𝗮𝘆 𝗠𝗼𝗺𝗲𝗻𝘁𝘂𝗺 Momentum may be the premier anomaly. But it doesn't seem to scale fractally. Analyzing 5-minute SPY ETF bars shows limited evidence of the momentum effect. More to do including adjusting for overnight returns. Stay tuned!
optionstocksmachines.substack.com/p/intraday-m...
Intraday Momentum
Limited evidence of the momentum effect on 5-minute bars in the SPY
optionstocksmachines.substack.com
April 2, 2025 at 7:28 PM
𝗛𝗙𝗪 𝟭𝟬: 𝗪𝗵𝗲𝗻 𝗮𝘃𝗲𝗿𝗮𝗴𝗲 𝘄𝗶𝗻𝘀 Using historical average growth rate with forward recursion outperforms all previous models, except, original naïve benchmark. But try recommending a naïve model to stakeholders. Heteroskedasticity models next. Stay tuned!
optionstocksmachines.substack.com/p/hfw-10-whe...
HFW 10: When average wins
An average growth rate forecast model beats the more sophisticated models thus far
optionstocksmachines.substack.com
March 31, 2025 at 6:10 PM
𝗖𝗿𝘆𝗽𝘁𝗼 𝗥𝗲𝗴𝗶𝗺𝗲: Revisiting our work on regime detection, we use clustering algorithms on crypto to generate trading signals, producing powerful outperformance. Stay tuned for other regime detection algorithms in upcoming posts.
optionstocksmachines.substack.com/p/crypto-reg...
#python #datascience
Crypto Regimes
Hierarchical clustering generates attractive trading signals in Bitcoin and Ethereum
optionstocksmachines.substack.com
March 28, 2025 at 5:35 PM
𝗕𝗢𝗧𝗪 𝟲: 𝗔𝗔𝗜𝗜 𝗥𝗲𝗱𝘂𝘅 Using prediction levels to drive trading signals we develop a strategy that outperforms buy-and-hold on cumulative and risk-adjusted returns. Not bad for a relatively straightforward model. Stay tuned for additional refinements!
optionstocksmachines.substack.com/p/botw-6-aai...
BOTW 6: AAII Redux
We build a relatively stable model using market implied reactions to the AAII survey
optionstocksmachines.substack.com
March 26, 2025 at 7:30 PM
𝗛𝗙𝗪 𝟵: 𝗚𝗿𝗼𝘄𝘁𝗵 𝗿𝗮𝘁𝗲 𝗳𝗼𝗿𝗲𝗰𝗮𝘀𝘁𝗶𝗻𝗴 Adding growth rate forecasting to toolbox. Provides intuition on 𝘴𝘵𝘢𝘵𝘪𝘰𝘯𝘢𝘳𝘪𝘵𝘺, but also motivates examination of next set models that explicitly forecast volatility. Stay tuned!
optionstocksmachines.substack.com/p/hfw-9-grow...
#python #datascience #timeseries
HFW 9: Growth rate forecasting
Setting the stage for volatility clustering
optionstocksmachines.substack.com
March 24, 2025 at 7:57 PM