~/kaustubh-lall

~/writing $ cat writing/mmg-exact-horizon-audit.md

MMG experiment log: when 48 bars is not 4 hours

2026-07-04 · Experiment Logs · 2 min read

An audit of the intraday model's four-hour labels found that shifting 48 five-minute bars forward only actually spans 4 hours 69.48% of the time, once real data gaps are counted. The label builder was rebuilt to join at the exact wall-clock offset instead.

The convention

The intraday model's four-hour labels came from a simple rule: count 48 rows of five-minute bars forward from any point and call that four hours later. The rule is only true if the underlying series has no gaps in it. OSRS's Grand Exchange data isn't gap-free: roughly 30% of items are missing a bar at any given time, since not every item trades on every five-minute tick.

The audit

An audit scanned 839,687 rows across the top 100 items by trading volume and found 22,830 interior gaps in the five-minute series. Of the 834,887 labels the 48-row rule had produced, only 580,076 actually landed 14,400 seconds (four real hours) later: 69.48%. The rest spanned some other interval, almost always longer, because a gap meant the 48th row forward had drifted past the four-hour mark. The audit's own summary of the bug: "counting 48 buses does not measure four hours if some buses never came."

The rebuild

The label builder now joins every label at the exact wall-clock offset, the bucket timestamp plus 14,400 seconds, instead of counting rows, and restarts its rolling-feature windows at every gap instead of letting them silently span one. The corrected dataset shrank as a result: 802,443 exact-horizon rows across 789 items, down from 834,887, with a 22.88% base rate for a 1%-plus price rise and a 2.19% base rate for a trade that stays positive after tax, spread, and slippage. Smaller, but every label in it now means exactly what its name says.

The full story lives in the MMG case study.

Related projects

← All writing