OPEN-SOURCE SCRIPT

Market Structure Volume Profile

273
This indicator visualizes volume profiles that are dynamically anchored to market structure events, rather than fixed time intervals. It builds these profiles using high-resolution intra-bar data to provide a precise view of where value is established during critical market phases.

Key Features:

Event-Based Profile Anchoring: The indicator starts a new profile based on one of three user-selected events ('Profile Anchor'):

Swing: A new profile begins when the 'impulse baseline' (derived from intra-bar delta) changes. This baseline adjusts when a new price pivot is confirmed: When a price high forms, the baseline moves to the lower of its previous level or the peak delta (max of delta O/C) at the pivot. When a price low forms, it moves to the higher of its previous level or the trough delta (min of delta O/C) at the pivot.

Structure: A new profile begins immediately on the bar that confirms a market structure break (e.g., a new HH or LL, based on a sequence of price pivots).

Delta: A new profile begins immediately on the bar that confirms a break in the cumulative delta's market structure (e.g., a new HH or LL in the delta). Both 'Swing' and 'Delta' anchors are derived from the same continuous (non-resetting) Cumulative Volume Profile Delta (CVPD), which is built from the intra-bar statistical analysis.

Statistical Profile Engine: For each bar in the anchored period, the indicator builds a volume profile on a lower 'Intra-Bar Timeframe'. Instead of simple tick counting, it uses advanced statistical models:

Allocation ('Allot model'): 'PDF' (Probability Density Function) distributes volume proportionally across the bar's range based on an assumed statistical model (e.g., T4-Skew). 'Classic' assigns all volume to the close.

Buy/Sell Split ('Volume Estimator'): 'Dynamic' applies a model that analyzes candle wicks and recent trend to estimate buy/sell pressure. 'Classic' classifies all volume based on the candle color.

Visualization & Lag: The indicator plots the final profile (as a polygon) and the developing statistical lines (POC, VA, VWAP, StdDev).

Note on Lag: All anchor events require Pivot Right Bars for confirmation.

In 'Structure' and 'Delta' mode, the developing lines (POC, VA, etc.) are plotted using a non-repainting method (showing the value from pivRi bars ago).

In 'Swing' mode, the profile is plotted retroactively, starting from the bar where the pivot occurred. The developing lines are also plotted with this full pivRi lag to align with the past data.

Flexible Display Modes: The finalized profile can be displayed in three ways: 'Up/Down' (buy vs. sell), 'Total' (combined volume), and 'Delta' (net difference).

Dynamic Row Sizing: Includes an option ('Rows per Percent') to automatically adjust the number of profile rows (buckets) based on the profile's price range.

Integrated Alerts: Includes 13 alerts that trigger for:

A new profile reset ('Profile was resetted').

Price crossing any of the 6 developing levels (POC, VA High/Low, VWAP, StdDev High/Low).

Alert Lag Assumption: In 'Swing' mode, alerts are delayed to match the retroactively plotted lines. In 'Structure' and 'Delta' modes, alerts fire in real-time based on the current price crossing the current (repainting) value of the metric, which may differ from the non-repainting plotted line.

Caution: Real-Time Data Behavior (Intra-Bar Repainting) This indicator uses high-resolution intra-bar data. As a result, the values on the current, unclosed bar (the real-time bar) will update dynamically as new intra-bar data arrives. This includes the values used for real-time alerts in 'Structure' and 'Delta' modes.

DISCLAIMER

For Informational/Educational Use Only: This indicator is provided for informational and educational purposes only. It does not constitute financial, investment, or trading advice, nor is it a recommendation to buy or sell any asset.

Use at Your Own Risk: All trading decisions you make based on the information or signals generated by this indicator are made solely at your own risk.

No Guarantee of Performance: Past performance is not an indicator of future results. The author makes no guarantee regarding the accuracy of the signals or future profitability.

No Liability: The author shall not be held liable for any financial losses or damages incurred directly or indirectly from the use of this indicator.

Signals Are Not Recommendations: The alerts and visual signals (e.g., crossovers) generated by this tool are not direct recommendations to buy or sell. They are technical observations for your own analysis and consideration.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน