Expand description
§Direction: what is the best SD can do at calling up or down?
Chapter 2 of the book found that squeeze and momentum measurements, on
their own, call direction no better than a coin flip once the market’s
upward drift is removed. This module widens the search to every family
of measurement that the finance literature says carries some direction
information, and lets a walk-forward test (sd_direction) decide which
of them earn their place.
The families, and the one-line reason each is here:
| Group | Measurements | Why it might know direction |
|---|---|---|
sd | blend, agreement, fired×decay×blend, tier, energy, stretch, semi | SD’s own reading |
mom | 5/21/63/126-bar returns, 12-minus-1-month return | trends persist; very short moves reverse |
trend | distance from 50/200-bar averages, drawdown from 1-year high | trend-following, anchoring |
vol | 20/126 vol ratio, vol level | calm markets drift up; panics overshoot |
rel | 63-bar return minus SPY’s | relative strength |
mkt | SPY trend, momentum, vol ratio, 5/21-bar return | the tide lifts (and sinks) most boats |
vix | VIX vs its 1-year average, VIX level, VIX minus realized vol | fear is paid for: high implied vol precedes better returns |
season | November–April flag, month sine/cosine | the “Halloween” seasonal |
sdw, sdm | SD’s reading on weekly and monthly bars | Extended SD’s idea: slower squeezes, slower trends |
Every value at bar t uses only bars <= t.
Structs§
- Gbm
- A small gradient-boosted tree ensemble for “will it close higher?”.
- GbmParams
- Market
Weather - Market weather on each SPY date: SPY’s own trend and VIX’s fear gauge.
Enums§
Constants§
- GROUPS
- Feature groups, in column order.
Functions§
- direction_
frame - Every direction feature for every bar of one symbol (
NaN= unusable). - group_
range - Column range of a group.
- n_
features - slow_sd
- SD’s reading on slower bars (weekly or monthly), mapped back to days.