Skip to content

Add MTF alignment/merge utilities on top of resampling #14

@TDamiao

Description

@TDamiao

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    crypto-specificCrypto-market specific indicators, utilities, and validations.help wantedExtra help is welcome from the community.v0.4Release gate work required before shipping v0.4.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions