Goal
Add multi-timeframe primitives on top of resampling so users can build top-down strategies (e.g., 1h trend + 5m entry).
Why
Issue #6 covers resampling. This issue focuses on timeframe alignment/merge utilities needed for real MTF strategy logic.
Depends on
Implementation prompt
Implement MTF helpers:
alignTimeframes(base, higher, options)
mergeTimeframeFeatures(base, higherFeatures, options)
- Optional
forwardFillUntilClose mode with strict boundary controls
Rules:
- No lookahead leakage (only finalized higher-timeframe data)
- Deterministic timestamp boundary handling
- Explicit behavior for gaps and missing candles
Scope
- Typed APIs for alignment/merge outputs
- Strict validation for unsorted timestamps and duplicate bars
- Time boundary options documented (UTC/session-aware)
Acceptance criteria
- No future leakage in merged features
- Alignment works for 1m->5m, 5m->1h, 1h->4h fixtures
- Tests validate gaps/partial higher bar behavior
- README contains one MTF example (trend timeframe + trigger timeframe)
Test plan
- Unit tests with handcrafted timestamp fixtures
- Property-style tests for monotonic timestamps and non-leakage invariants
- Example smoke test using exported API only
Goal
Add multi-timeframe primitives on top of resampling so users can build top-down strategies (e.g., 1h trend + 5m entry).
Why
Issue #6 covers resampling. This issue focuses on timeframe alignment/merge utilities needed for real MTF strategy logic.
Depends on
Implementation prompt
Implement MTF helpers:
alignTimeframes(base, higher, options)mergeTimeframeFeatures(base, higherFeatures, options)forwardFillUntilClosemode with strict boundary controlsRules:
Scope
Acceptance criteria
Test plan