OPEN-SOURCE SCRIPT
HTF Candle Architecture [MQLSoftware]

HTF Candle Architecture overlays up to three higher-timeframe candles simultaneously on any chart, rendering each at full structural fidelity — body, wicks, and open mid-line — and extending the live candle in real time as bars print. A right-side panel shows the bias, range position, and cross-timeframe alignment for all active levels. Level-touch signals mark when price closes near a key HTF boundary.
This is a visual analytical tool intended for chart reading and structural context. It does not execute trades and does not provide financial advice.
Key Features
Core Concept
Most HTF candle overlay scripts show a single timeframe. The useful information in a multi-timeframe view is not just that a candle exists at a higher timeframe — it is the structural relationship between that candle and the current position of price, repeated across multiple timeframes at once.
This indicator builds that view directly. Three independent HTF levels render simultaneously with separate depth cues: the closest timeframe uses a lighter body and thinner border; deeper timeframes use heavier borders and darker fills, so the layered structure reads without confusion at a glance.
The range position gauge is the specific addition that single-timeframe tools miss. Whether price is at 91% or 47% of the current Weekly candle's range changes the structural read. The gauge answers that for all three active levels without requiring the user to manually measure.
The alignment row adds the cross-timeframe read in a single line. When all enabled timeframes agree on direction, a single colored label replaces the need to read each row and compare manually. When they conflict, ⇅ MIXED in amber flags it explicitly so a false conviction read is not made.
The level-touch signal system layers actionable entries on top of the structural view. It applies a zone-entry filter — the signal fires only when price moves into the zone on this bar, not while it is already inside — and a per-period gate that allows at most one signal per active HTF candle per level. Combined, these two filters remove the signal spam that plagues basic proximity alerts.
Anatomy of the Display
HTF candle bodies are box objects spanning the HTF period's bar range. The live body updates right-edge and color on every bar. Closed candles are committed once the HTF period ends and stay anchored.
Wicks are line objects centered within the body's bar range, connecting the body edge to the High or Low. In Bars mode, the same lines form the H-L spine, open tick, and close tick of a standard bar representation.
The open mid-line is a dashed horizontal line at the Open price inside the body, visible when the body height exceeds 5% of ATR14, so it is suppressed on doji-like candles where it would overlap the border.
OHLC Projection lines are dotted horizontals extending from the HTF period start to `bar_index + N bars` (configurable). Each carries a tiny label on the right showing the timeframe abbreviation, level name, and price. They update every bar, so they track the live candle's developing values until the period closes.
The panel occupies the top-right corner. Rows 1-3 show the active timeframe, its bias (↑ BULL / ↓ BEAR), and the range position gauge. Row 4 shows the alignment verdict with a colored background. Rows 5-6 show the last signal fired. The header row shows the ticker.
Level-touch signal arrows appear below or above the bar that closes near a HTF level: ▲ for a Low touch (potential support), ▼ for a High touch (potential resistance). Signal size scales with HTF depth: L1 uses the smallest arrow, L3 the largest.
Notes on Repainting
Typical Analysis Workflow
A common analytical workflow may include:
Configuration
Auto Timeframes — when enabled, selects the three most relevant standard TFs above the chart automatically. Disable to pin timeframes manually per level.
Candles to Show — how many closed HTF candles to keep on chart per level. Older candles are removed as new ones close.
Display Type — Candles, Bars, or HL. Applied to all levels simultaneously.
Per level (HTF 1 / 2 / 3) — enable/disable, custom timeframe, body opacity (0=opaque to 95=near-transparent), and separate bull/bear color pickers.
Visual group — show/hide wicks, mid-line, timeframe labels, live-candle highlight, bias background, anchor dots at period starts, and new-period shade.
Projections — show/hide H, L, O, C levels independently; extend-right bars; price labels on/off.
Panel — show/hide.
Signals — show/hide; touch threshold as ATR multiplier (0.05–1.0); H/L and Open toggles per level independently.
Markets and Timeframes
Works on any instrument and timeframe where at least one higher timeframe exists above the chart:
Auto timeframe selection scales from 1m charts (1H / 4H / D auto) through Daily (W / M auto). At the top of the timeframe ladder, fewer than three higher timeframes exist and the unused levels can be disabled.
Alerts
All alerts fire on confirmed bars only.
This is a visual analytical tool intended for chart reading and structural context. It does not execute trades and does not provide financial advice.
Key Features
- Three simultaneous HTF levels, auto-selected from the standard timeframe ladder above the chart, with an override for manual pinning
- Three display modes per level: Candles (body box + wicks), Bars (H-L spine with open/close ticks), and HL (high and low range lines only)
- Live candle extends in real time — the body, wicks, and projection lines follow price as the current HTF period develops
- OHLC Projection lines project the current HTF candle's High, Low, Open, and Close as dotted levels to the right, labeled with the timeframe and price
- Range Position gauge — a filled-block bar (`████░░░ 71%`) showing where price sits inside each HTF candle's range; extremes (above 80% or below 20%) highlight in amber
- Alignment row — cross-timeframe bias summary: ↑↑ ALIGNED when all enabled levels agree bullish, ↓↓ ALIGNED when all agree bearish, ⇅ MIXED when they conflict
- Level-touch signals — fires when price first closes within a configurable ATR threshold of a HTF High, Low, or Open; one signal per HTF candle, per level
- HTF Bias Background — subtle background tint matching the primary level's direction (blue for bull, red for bear)
- Four alert conditions, all confirmed-bar only
Core Concept
Most HTF candle overlay scripts show a single timeframe. The useful information in a multi-timeframe view is not just that a candle exists at a higher timeframe — it is the structural relationship between that candle and the current position of price, repeated across multiple timeframes at once.
This indicator builds that view directly. Three independent HTF levels render simultaneously with separate depth cues: the closest timeframe uses a lighter body and thinner border; deeper timeframes use heavier borders and darker fills, so the layered structure reads without confusion at a glance.
The range position gauge is the specific addition that single-timeframe tools miss. Whether price is at 91% or 47% of the current Weekly candle's range changes the structural read. The gauge answers that for all three active levels without requiring the user to manually measure.
The alignment row adds the cross-timeframe read in a single line. When all enabled timeframes agree on direction, a single colored label replaces the need to read each row and compare manually. When they conflict, ⇅ MIXED in amber flags it explicitly so a false conviction read is not made.
The level-touch signal system layers actionable entries on top of the structural view. It applies a zone-entry filter — the signal fires only when price moves into the zone on this bar, not while it is already inside — and a per-period gate that allows at most one signal per active HTF candle per level. Combined, these two filters remove the signal spam that plagues basic proximity alerts.
Anatomy of the Display
HTF candle bodies are box objects spanning the HTF period's bar range. The live body updates right-edge and color on every bar. Closed candles are committed once the HTF period ends and stay anchored.
Wicks are line objects centered within the body's bar range, connecting the body edge to the High or Low. In Bars mode, the same lines form the H-L spine, open tick, and close tick of a standard bar representation.
The open mid-line is a dashed horizontal line at the Open price inside the body, visible when the body height exceeds 5% of ATR14, so it is suppressed on doji-like candles where it would overlap the border.
OHLC Projection lines are dotted horizontals extending from the HTF period start to `bar_index + N bars` (configurable). Each carries a tiny label on the right showing the timeframe abbreviation, level name, and price. They update every bar, so they track the live candle's developing values until the period closes.
The panel occupies the top-right corner. Rows 1-3 show the active timeframe, its bias (↑ BULL / ↓ BEAR), and the range position gauge. Row 4 shows the alignment verdict with a colored background. Rows 5-6 show the last signal fired. The header row shows the ticker.
Level-touch signal arrows appear below or above the bar that closes near a HTF level: ▲ for a Low touch (potential support), ▼ for a High touch (potential resistance). Signal size scales with HTF depth: L1 uses the smallest arrow, L3 the largest.
Notes on Repainting
- HTF candle visual rendering uses `request.security` with `lookahead=barmerge.lookahead_on`. The live body and wicks update intrabar as the current HTF candle develops. This is display-only and is the standard practice for visualizing a forming HTF candle. The `lookahead_on` value is never used in any signal condition.
- All signals are gated by `barstate.isconfirmed` and fire only on closed bars, never intrabar.
- Zone-entry filter: a signal fires only if `math.abs(close - level) <= threshold` on this bar AND `math.abs(close[1] - level) > threshold` on the prior bar. Price must move into the zone on this bar; already being inside the zone does not retrigger.
- Per-period gate: a boolean flag resets at the start of each new HTF candle and is set on the first signal. At most one signal fires per HTF period per level.
- Alerts are gated by `barstate.isconfirmed` and fire once per confirmed bar.
Typical Analysis Workflow
A common analytical workflow may include:
- Checking the alignment row to establish a directional context — ↑↑ or ↓↓ ALIGNED suggests all active timeframes agree; ⇅ MIXED means caution
- Reading the range position gauge to see whether price is extended (above 80% or below 20% of the HTF range, highlighted in amber) or mid-range
- Watching the OHLC projection lines for the current session's active levels — these are the structurally meaningful prices for the live HTF candle
- Noting level-touch signals as markers where price has closed near a key HTF boundary; combine with other analysis to assess significance
Configuration
Auto Timeframes — when enabled, selects the three most relevant standard TFs above the chart automatically. Disable to pin timeframes manually per level.
Candles to Show — how many closed HTF candles to keep on chart per level. Older candles are removed as new ones close.
Display Type — Candles, Bars, or HL. Applied to all levels simultaneously.
Per level (HTF 1 / 2 / 3) — enable/disable, custom timeframe, body opacity (0=opaque to 95=near-transparent), and separate bull/bear color pickers.
Visual group — show/hide wicks, mid-line, timeframe labels, live-candle highlight, bias background, anchor dots at period starts, and new-period shade.
Projections — show/hide H, L, O, C levels independently; extend-right bars; price labels on/off.
Panel — show/hide.
Signals — show/hide; touch threshold as ATR multiplier (0.05–1.0); H/L and Open toggles per level independently.
Markets and Timeframes
Works on any instrument and timeframe where at least one higher timeframe exists above the chart:
- Forex
- Stocks and Indices
- Commodities
- Cryptocurrencies
Auto timeframe selection scales from 1m charts (1H / 4H / D auto) through Daily (W / M auto). At the top of the timeframe ladder, fewer than three higher timeframes exist and the unused levels can be disabled.
Alerts
- HTF 1 H/L Touch — price closed near HTF 1 High or Low
- HTF 2 H/L Touch — price closed near HTF 2 High or Low
- HTF 3 H/L Touch — price closed near HTF 3 High or Low
- Any HTF H/L Touch — price closed near any active HTF High or Low
All alerts fire on confirmed bars only.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
📊 MQLSoftware — Premium TradingView indicators
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
📊 MQLSoftware — Premium TradingView indicators
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
🎯 Featured: Pro Swing Trading System | DisruptNEX Edge System
🌐 mqlsoftware.info
For educational purposes only.
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。