OPEN-SOURCE SCRIPT

Market Structure [TFO]

229
📊 Market Structure [TFO] — Pine Script Indicator
Author: © tradeforopp
License: Mozilla Public License 2.0
Platform: TradingView
Type: Market structure analyzer (BOS/MSS, swings, bar color)

🧠 What It Does:
This indicator automatically identifies market structure shifts (MSS) and breaks of structure (BOS) based on pivot highs and lows. It detects when price violates previous swing points and visually marks the shift between bullish and bearish phases.

🔍 Key Features:
Swing Detection:

Uses pivot_strength to determine significant swing highs and lows.

Swings are tracked using a custom swing structure with index and value.

MSS & BOS Logic:

A Market Structure Shift (MSS) occurs when price changes direction (e.g., bullish to bearish).

A Break of Structure (BOS) happens when the price breaks the previous swing without changing trend direction.

Visual Markers:

Labels on chart showing MSS or BOS at break levels.

Optional pivot markers as small triangle shapes at swing points.

Dashed/solid/dotted lines between the break point and current candle.

Bar Coloring:

Turns candles green for bullish breaks, red for bearish breaks.

Controlled via the “Show Bar Colors” setting.

Alerts:

Alert conditions for all MSS/BOS events.

Can be used for automation or signals in TradingView.

⚙️ User Inputs:
Pivot Strength – How many candles left/right to confirm a high/low.

Show Pivots – Enables small triangle markers.

Show BOS/MSS – Toggles structure break visuals and labels.

Line Style – Customizes BOS/MSS line appearance.

Bar Colors – Enables green/red candle coloring on structure changes.

🧩 Use Cases:
Track structural shifts in real time on any asset.

Build smart money concept (SMC) strategies.

Filter entries/exits based on trend changes.

Combine with liquidity or volume-based tools for confirmation.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.