Align to Bars¶
Data · Multi-Timeframe
Forward-fill a series onto a target bars time axis with no lookahead. Use after HigherTimeframe → indicator to bring the higher-TF result back to the lower-TF cadence for use in signals.
Align to Bars is the other half of multi-timeframe analysis. Higher Timeframe gives you a slow series at the slow cadence (one value per day, say); Align to Bars projects that series back down onto your fast bars so every fast bar carries the latest completed higher-TF value. Without it, a daily indicator and your H1 chart live on different time axes and can't be compared. With it — and this is the critical part — that projection happens with no lookahead.
How it works¶
Wire the Source (the higher-TF series — e.g. a daily EMA) and the Target (the lower-TF bars whose time axis you want to map onto — usually the same bars feeding the rest of your strategy). The block forward-fills: each target bar takes the most recent source value that had already closed at or before that bar's time. So an H1 bar at 14:00 uses yesterday's completed daily value until today's daily bar closes — it never borrows a value from a candle that hasn't finished yet. Early target bars, before any source value exists, come out as NaN.
That forward-fill-from-closed-values rule is what makes multi-timeframe honest. The naive way to merge timeframes — aligning on calendar date — accidentally hands a bar the daily close from the end of its own day, which is future information. Align to Bars structurally prevents that.
When to use it¶
Use it immediately after computing any indicator on higher-timeframe bars, whenever you want that result available in lower-timeframe signal logic. The canonical chain is Higher Timeframe → indicator → Align to Bars → your signals. Any time you find yourself wanting "the daily RSI on my H1 chart" or "the weekly trend as an H1 filter," this is the block that makes the two cadences meet safely.
Example¶
Bring a daily EMA down to H1: resample with Higher Timeframe (D1, closed_only), compute a 50-EMA on those daily bars, then wire that EMA into Source and your H1 Data Source bars into Target. The Aligned output now gives every H1 bar the current daily-EMA value — feed it into a Greater Than against price to gate H1 longs to "above the daily EMA." Backtest in the Tester.
Tips & gotchas¶
- It's the no-lookahead bridge. Forward-filling from closed higher-TF values is what keeps multi-timeframe backtests honest — never hand-merge on date instead.
- Early bars are
NaNuntil the first higher-TF value closes — comparisons against NaN are false, so your strategy simply waits, which is correct. - Target = your trading bars. Map onto the same lower-TF bars the rest of the graph uses, or the alignment is meaningless.
- Always pairs with Higher Timeframe — resample up, compute, then align back down.
Related blocks¶
Inputs¶
| Socket | Type | What to wire in |
|---|---|---|
| Source | series |
The series to realign — typically an indicator computed on higher-TF bars (e.g., daily EMA) that we want to evaluate at every lower-TF bar. |
| Target | bars |
Bars whose time axis the source will be projected onto. Usually the same lower-TF bars feeding the rest of the strategy. |
Outputs¶
| Output | Type | Plots as | Description |
|---|---|---|---|
| Aligned | series |
Line · sub-pane | Source values forward-filled onto the target time axis. Early target bars (before any source bar has closed) are NaN. |
Reference auto-generated from the block catalog · category Data.