OPEN-SOURCE SCRIPT

Structure Pivot (LL-HL / HH-LH)

281
Structure Pivot (LL-HL / HH-LH) - Indicator Guide

This indicator scans for market structure pivot patterns—specifically the bullish Higher Low (LL–HL) and the bearish Lower High (HH–LH)—across multiple lengths simultaneously.

It automatically selects the most optimal pattern based on a "Priority Mode" and plots the structure and breakout/breakdown levels on the chart.

1. Basic Calculation Method
The indicator builds upon TradingView’s ta.pivotlow and ta.pivothigh functions to identify structural points.

Bullish Structure (LL–HL)
1.LL (Lowest Low): A standard Pivot Low is identified.
2.HL (Higher Low): A subsequent Pivot Low forms higher than the previous LL. This completes the setup.
3.Pivot Line (Resistance): The indicator finds the highest price (High) that occurred between the LL and the HL. This level becomes the breakout trigger.

Bearish Structure (HH–LH)
1.HH (Highest High): A standard Pivot High is identified.
2.LH (Lower High): A subsequent Pivot High forms lower than the previous HH. This completes the setup.
3.Pivot Line (Support): The indicator finds the lowest price (Low) that occurred between the HH and the LH. This level becomes the breakdown trigger.

2. Multi-Length Scanning
Unlike standard indicators that use a single fixed length (e.g., Length = 5), this indicator scans a range of lengths simultaneously.
・Settings: Defined by Min Length and Max Length.
・Mechanism: If set to Min=2 and Max=10, the indicator internally runs 9 separate calculations (Length 2 through 10) in parallel.

This allows it to capture everything from small, short-term pullbacks to larger, significant structural pivots without manual adjustment.

3. Priority Mode System
Since multiple lengths are scanned, multiple valid patterns may appear at the same time. The Priority Mode determines which single pattern is the "winner" and gets displayed.

A. Tightest Structure (Default)
・For Bullish (Long): Selects the pattern with the lowest Pivot Line (Resistance).
・For Bearish (Short): Selects the pattern with the highest Pivot Line (Support).
・Advantage: It finds the "tightest" contraction (like a VCP). This offers the entry point closest to the stop-loss level, providing the best Risk/Reward ratio.

B. Longest Length
・Selects the pattern detected by the longest length setting.
・Advantage: Focuses on major structural points, filtering out short-term noise. Best for trend confirmation.

C. Shortest Length
・Selects the pattern detected by the shortest length setting.
・Advantage: Extremely sensitive. Best for scalping or catching immediate micro-pullbacks.

4. Real-Time Logic & Features
Structure Invalidation (Failure)
・Bullish: If the current price drops below the HL (the support of the structure), the setup is considered failed.
・Bearish: If the current price rises above the LH (the resistance of the structure), the setup is considered failed.
・Result: All lines and labels for that structure are immediately deleted to keep the chart clean.

Pivot Line Extension
・As long as the structure remains valid (price hasn't violated the HL or LH), the Pivot Line extends to the right, acting as a live reference for breakouts or breakdowns.

Alerts
・Bullish Breakout: Triggered when the Close price crosses over the Pivot Line.
・Bearish Breakdown: Triggered when the Close price crosses under the Pivot Line.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.