OPEN-SOURCE SCRIPT

Market Structure - MTF

114
Overview

This indicator maps market structure by detecting confirmed swing points, labelling them as HH, HL, LH or LL, and marking every structural break as either a Break of Structure (BOS) or a Change of Character (CHoCH). It runs on the chart timeframe by default and can optionally read structure from any higher timeframe while you work on a lower one.

How swings are detected

Swings come from ta.pivothigh / ta.pivotlow at a user-defined Pivot Strength. A pivot requires that many closed bars on each side before it is confirmed, so structure labels never move once drawn — the trade-off is that each swing appears with that many bars of delay.

How swings are classified

Most structure scripts label a swing high as HH whenever its wick exceeds the previous swing high. This script requires both conditions: the new swing's high must exceed the previous swing's high and its close must exceed the previous swing's close. A single wick poking above a prior high with a weak close is labelled LH instead. The low side mirrors this — LL requires both a lower low and a lower close. This produces fewer HH/LL tags and filters out swings driven entirely by liquidity wicks.

How breaks are classified

The script maintains a directional bias that flips only on a structural break:

BOS — price breaks the last swing high while bias is bullish, or the last swing low while bias is bearish. Continuation.
CHoCH — price breaks the last swing low while bias is bullish, or the last swing high while bias is bearish. This is the first break against the prevailing structure and marks a potential regime change.

Each swing level can only be broken once, so a level never fires repeated signals. A break draws a line from the origin swing to the break bar, with the label placed above the line for bullish events and below for bearish.

Break Confirmation setting

Close — a break requires a candle to close beyond the level. Stricter, fewer signals, drawn as a solid line.
Wick — any trade through the level counts. Earlier signals, drawn as a dashed line to flag that price never committed beyond it.

Structure Timeframe setting

Leave blank to follow the chart. Set it explicitly (e.g. 60) to keep higher-timeframe structure on screen while executing on a lower timeframe. Requests use lookahead_off, so higher-timeframe swings only appear after that bar closes.

Dashboard

Shows the active structure timeframe, current bias, the live swing high and swing low, and the CHoCH level — the price that would invalidate the current bias if broken.

Alerts

Four conditions: Bullish BOS, Bearish BOS, Bullish CHoCH, Bearish CHoCH.

Settings guidance

Lower Pivot Strength (3–4) gives more granular intraday structure; higher values (5–7+) give cleaner swings on daily and above. Higher values on higher timeframes generally produce more readable structure. Label Offset controls the vertical gap between text and lines in ATR units.

Notes and limitations

A CHoCH is an early warning, not confirmation — many traders wait for a subsequent BOS in the new direction before treating a reversal as established. Structure labels and break tests use different criteria by design: labels compare closes for classification, while the break test follows your Break Confirmation setting against the wick extreme, so a swing tagged LH can still produce a bullish BOS if price later closes above its high. In ranging conditions the bias will flip frequently. This tool describes structure; it does not generate entries or exits on its own.

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。