Skip to main content

Module direction

Module direction 

Source
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:

GroupMeasurementsWhy it might know direction
sdblend, agreement, fired×decay×blend, tier, energy, stretch, semiSD’s own reading
mom5/21/63/126-bar returns, 12-minus-1-month returntrends persist; very short moves reverse
trenddistance from 50/200-bar averages, drawdown from 1-year hightrend-following, anchoring
vol20/126 vol ratio, vol levelcalm markets drift up; panics overshoot
rel63-bar return minus SPY’srelative strength
mktSPY trend, momentum, vol ratio, 5/21-bar returnthe tide lifts (and sinks) most boats
vixVIX vs its 1-year average, VIX level, VIX minus realized volfear is paid for: high implied vol precedes better returns
seasonNovember–April flag, month sine/cosinethe “Halloween” seasonal
sdw, sdmSD’s reading on weekly and monthly barsExtended 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
MarketWeather
Market weather on each SPY date: SPY’s own trend and VIX’s fear gauge.

Enums§

GbmNode

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.