OPEN-SOURCE SCRIPT
LL-HL Pivot

This indicator scans for the bullish structure known as a Higher Low (HL) across multiple lengths simultaneously, automatically selects the most suitable pattern, and plots it on the chart.
Below is a detailed explanation of how it works.
1. Basic Calculation Method (Definition of LL and HL)
This indicator is built on TradingView’s ta.pivotlow function.
Detecting Pivot Lows
For a given length, a Pivot Low is identified as the lowest point among the candles within the specified range to the left and right.
LL and HL Determination
LL (Lowest Low): The most recent Pivot Low is treated as the previous low.
HL (Higher Low): When a new Pivot Low forms above the previous LL, it is recognized as an HL, and the setup is considered “complete.”
Identifying the Pivot Line
During the LL–HL structure, the highest high between them is identified and used as the breakout level (Pivot Line / resistance), where a horizontal line is drawn.
2. Multi-Length Scanning
Unlike standard indicators that use only one length (e.g., Length = 5), this indicator evaluates a full range of lengths.
Min Length to Max Length
Example: Min = 2, Max = 10
Internally, it functions as if nine separate indicators (Length 2, 3, 4 … 10) are running simultaneously.
This allows the indicator to capture:
Small waves (short-term pullbacks)
Larger waves (broader structural moves)
3. Priority Mode System
Because multiple lengths are calculated at the same time, different LL–HL patterns may appear simultaneously.Priority Mode determines which setup is selected and displayed.
A. Lowest LH
Selects the pattern with the lowest pivot line (intermediate high).
Advantages:
Produces the lowest possible entry price
B. Longest Length
Selects the pattern with the longest length.
Advantages:
Focuses on larger structures and broader waves
Filters out noise
C. Shortest Length
Selects the pattern with the shortest length.
Advantages:
Reacts quickly to small moves
Useful for scalping or fast trend-following
Captures very short-term pullbacks
4. Additional Behavior and Features
Real-Time Invalidation
If price breaks below the confirmed HL, the structure is immediately considered invalid.
All previously drawn lines and labels are removed instantly, preventing outdated structures from remaining on the chart.
Pivot Line Extension
As long as the HL remains intact, the Pivot Line (breakout level) continues extending to the right.
Alerts
An alert can be triggered the moment price breaks above the Pivot Line on a closing basis.
Below is a detailed explanation of how it works.
1. Basic Calculation Method (Definition of LL and HL)
This indicator is built on TradingView’s ta.pivotlow function.
Detecting Pivot Lows
For a given length, a Pivot Low is identified as the lowest point among the candles within the specified range to the left and right.
LL and HL Determination
LL (Lowest Low): The most recent Pivot Low is treated as the previous low.
HL (Higher Low): When a new Pivot Low forms above the previous LL, it is recognized as an HL, and the setup is considered “complete.”
Identifying the Pivot Line
During the LL–HL structure, the highest high between them is identified and used as the breakout level (Pivot Line / resistance), where a horizontal line is drawn.
2. Multi-Length Scanning
Unlike standard indicators that use only one length (e.g., Length = 5), this indicator evaluates a full range of lengths.
Min Length to Max Length
Example: Min = 2, Max = 10
Internally, it functions as if nine separate indicators (Length 2, 3, 4 … 10) are running simultaneously.
This allows the indicator to capture:
Small waves (short-term pullbacks)
Larger waves (broader structural moves)
3. Priority Mode System
Because multiple lengths are calculated at the same time, different LL–HL patterns may appear simultaneously.Priority Mode determines which setup is selected and displayed.
A. Lowest LH
Selects the pattern with the lowest pivot line (intermediate high).
Advantages:
Produces the lowest possible entry price
B. Longest Length
Selects the pattern with the longest length.
Advantages:
Focuses on larger structures and broader waves
Filters out noise
C. Shortest Length
Selects the pattern with the shortest length.
Advantages:
Reacts quickly to small moves
Useful for scalping or fast trend-following
Captures very short-term pullbacks
4. Additional Behavior and Features
Real-Time Invalidation
If price breaks below the confirmed HL, the structure is immediately considered invalid.
All previously drawn lines and labels are removed instantly, preventing outdated structures from remaining on the chart.
Pivot Line Extension
As long as the HL remains intact, the Pivot Line (breakout level) continues extending to the right.
Alerts
An alert can be triggered the moment price breaks above the Pivot Line on a closing basis.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。