HTF Fractal Bars [Herman]

4 632
HTF Fractal Bars [Herman] shows up to three higher-timeframe (HTF) OHLC bar panels to the right of price, built directly from the chart's own bars. It adds a Fractal Agreement engine that classifies what each HTF's live bar is doing relative to the previous closed HTF bar, and scores how strongly the selected timeframes agree on direction.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

█ WHAT IT DOES

▸ Draws compact OHLC panels for up to three higher timeframes (default 15m / 1h / 4h) next to the current price, so the higher-timeframe structure stays visible while you work on a lower-timeframe chart.
▸ Labels the last three HTF bars in each panel as C1, C2 and C3:
C1 = two closed HTF bars ago
C2 = the last closed HTF bar
C3 = the live (still forming) HTF bar
▸ Marks sweeps (a bar trading beyond the previous bar's high or low and closing back inside it) and three-bar fair value gaps between HTF bars.
▸ Projects the HTF1 C1 / C2 / C3 highs and lows, the C3 open and optional period separators onto the main chart.
▸ Classifies the phase of each HTF's live bar and combines the three phases into one weighted agreement reading, shown in a table with a progress bar.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

█ HOW IT WORKS

▸ HTF bars from chart data
The script does not request data from another timeframe. Each HTF bar is aggregated from the chart's own bars: open, high, low and close, plus the exact chart bar on which the high and the low were made. Because of this, the HTF levels projected onto the chart start at the bar where each extreme actually formed, and the panels always show the same price data as your chart.

▸ Phase classification
For every enabled HTF, the live bar (C3) is compared with the last closed bar (C2):

- Expansion ▲ / ▼ — C3 has traded beyond C2's high (low) and price is accepted beyond it
- High swept ▼ — C3 has traded above C2's high, but price is back at or below it
- Low swept ▲ — C3 has traded below C2's low, but price is back at or above it
- Outside ▲ / ▼ / · — C3 has taken both sides of C2; the direction depends on whether price is above, below or inside C2's range
- Inside · — C3 has not taken either side of C2 yet

"Accepted beyond" means price is past the level by at least the Acceptance buffer (in ticks, default 0).

▸ Agreement score
Each phase counts as bullish (+1), bearish (−1) or neutral (0). This value is multiplied by the timeframe's weight (default 1 / 2 / 3, so higher timeframes carry more weight). Agreement is the absolute weighted sum divided by the total weight of the active timeframes, shown as a percentage together with a direction. Neutral phases lower the agreement because they still count in the total weight.

Example with default weights: 15m High swept ▼ (bearish), 1h Inside (neutral), 4h Expansion ▼ (bearish). The weighted sum is −1 + 0 − 3 = −4 out of a total weight of 6, so the table reads Bearish, 67%.

At least two active timeframes are required; with fewer, the table shows "Need 2+ HTFs".

▸ Update modes
- On chart-bar close (default): phases are evaluated with the last closed chart bar, so the table does not change while a chart bar is forming.
- Live (every tick): phases follow the forming chart bar and can change until it closes.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

█ WHAT YOU SEE

▸ HTF panels: classic OHLC bars (vertical line = high/low, left tick = open, right tick = close) with C1 / C2 / C3 tags, dotted high/low marks, sweep lines and grey FVG zones.
▸ Main chart: HTF1 C1 / C2 / C3 highs and lows, the C3 open, optional separators and an optional developing C3 range box.
▸ Table (bottom right by default):
Bias — Bullish / Bearish / Conflict / Neutral
Agreement — a shaded progress bar and the percentage
Aligned — number of bullish, bearish and neutral timeframes
Update — the active update mode
HTF Phase — the current phase of each timeframe

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

█ HOW TO USE IT

1. Use a standard intraday chart (for example 1m or 5m) and choose HTFs that are higher than, and exact multiples of, the chart timeframe.
2. Read the panels first: where C3 is relative to C2, and whether a sweep or a gap is involved.
3. Use the table as context. High agreement means the selected timeframes are in the same phase direction; Conflict means they are pulling in different directions.
4. A common way to use it is as a filter: favour setups from your own method only when they point in the same direction as the HTF bias, and be more selective when agreement is low or in conflict.
5. Adjust the weights to match your style. A weight of 0 keeps a timeframe visible in the table but removes it from the score.

The agreement reading describes the current state of the higher timeframes. It is not a buy or sell signal, and it should not be used on its own to make trading decisions.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

█ KEY SETTINGS


▸ HTF panels — three timeframes with on/off switches, number of bars shown (3–8), offset, spacing and gap between panels
▸ Markings — C1 / C2 / C3 tags, level marks, sweeps, FVG zones and main-chart structure for HTF1
▸ Style — every colour, transparency and line width
▸ Agreement Table — on/off, Dark / Light theme, size and position
▸ Fractal Agreement engine — update mode, acceptance buffer, per-timeframe weights and progress bar length

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

█ WHAT IS ORIGINAL

Displaying higher-timeframe bars on a lower-timeframe chart is not new. What this script adds:

▸ A phase classifier that reads each HTF's live bar in terms of range interaction with the previous closed bar (expansion, sweep and rejection, outside, inside), rather than trend indicators or moving averages.
▸ A weighted agreement score across up to three timeframes, with an optional bar-close update mode so the reading is stable inside a forming chart bar.
▸ HTF bars aggregated from chart data with the time of each extreme preserved, so the projected levels start where the high or low actually formed.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

█ LIMITATIONS

▸ The panels are a visual display placed to the right of the last bar. They are not positioned in time.
▸ C3 is a live bar. Its high, low and close change until the HTF bar closes, so its phase, and any sweep or gap marks that involve C3, are provisional until then. Closed bars (C1, C2 and older) do not change.
▸ In Live mode the table can change on every tick. In the default bar-close mode it updates once per closed chart bar, so it lags the live price by up to one chart bar.
▸ Works on standard chart types only (not Heikin Ashi, Renko, Kagi, Point & Figure, Line Break or Range). Intraday HTFs must be exact multiples of the chart timeframe. If no selected HTF fits the chart, a notice is shown instead of the panels.
▸ History is limited to the bars loaded on the chart. The first HTF bar in the history is usually incomplete and is not used.
▸ The script does not measure or report the historical accuracy of the agreement reading. No performance of any kind is implied.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

█ OPEN-SOURCE NOTES


The source code is published under the Mozilla Public License 2.0. The code is organised in commented sections (aggregation, agreement engine, rendering, table) so the logic described above can be checked directly. If you reuse parts of it, please follow the TradingView House Rules on open-source reuse and credit the original publication.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This script is an analysis tool for studying higher-timeframe structure. It does not provide financial advice and does not predict future price movement.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.