OPEN-SOURCE SCRIPT
Structure Lite - Automatic Major Trend Lines

Structure Lite – Pivot-Based Market Structure Visualization
OVERVIEW
Structure Lite is an open-source charting tool designed to assist traders in visualizing higher-timeframe market structure. The script identifies major swing points using high-period pivot analysis and projects structural support and resistance lines directly on the chart. Its purpose is to highlight persistent market structure while minimizing visual noise.
CORE CONCEPTS & CALCULATIONS
Pivot Identification
The script uses Pine Script’s built-in ta.pivothigh() and ta.pivotlow() functions to identify confirmed swing highs and lows. A pivot is only validated after a user-defined number of bars (Major Pivot Lookback) have formed on both sides of the price extreme, ensuring that only structurally significant pivots are selected.
Structural Pairing
Each structural line is created only after two consecutive pivots of the same type are confirmed (high-to-high or low-to-low). The script stores the price and bar index of these pivots and uses them as fixed anchor points.
Line Projection
Once a valid pivot pair is formed, the script draws a line between the two points using line.new() and extends it forward using extend.right. These lines represent projected structural boundaries rather than trade signals.
Object Management
To maintain chart clarity and performance, the script manages all drawn objects through a line[] array. A FIFO (First-In, First-Out) method is applied so that only the three most recent structural lines remain visible. Older lines are automatically deleted as new ones are created.
DESIGN PHILOSOPHY & ORIGINALITY
While many indicators plot frequent swing points or short-term pivots, Structure Lite focuses on structural persistence. By filtering for higher-period pivots and limiting the number of displayed projections, the script emphasizes dominant market structure rather than short-term fluctuations. This approach is intended to support discretionary analysis, not replace it.
HOW TO USE
Major Pivot Lookback
Increase the value to focus on higher-timeframe structure (e.g., swing or position trading).
Decrease the value to visualize intraday structural levels.
Visual Encoding
Green lines represent projected structural support
Red lines represent projected structural resistance
Visibility Control
A boolean input allows all structure lines to be hidden instantly to restore a clean price chart.
LIMITATIONS & DISCLAIMER
This script is a visualization tool only. It does not generate trade signals, entry or exit points, alerts, or directional forecasts. All plotted levels are derived from historical price action and may change as new pivots form. The script is provided for educational and analytical purposes and should be used in conjunction with other forms of market analysis
OVERVIEW
Structure Lite is an open-source charting tool designed to assist traders in visualizing higher-timeframe market structure. The script identifies major swing points using high-period pivot analysis and projects structural support and resistance lines directly on the chart. Its purpose is to highlight persistent market structure while minimizing visual noise.
CORE CONCEPTS & CALCULATIONS
Pivot Identification
The script uses Pine Script’s built-in ta.pivothigh() and ta.pivotlow() functions to identify confirmed swing highs and lows. A pivot is only validated after a user-defined number of bars (Major Pivot Lookback) have formed on both sides of the price extreme, ensuring that only structurally significant pivots are selected.
Structural Pairing
Each structural line is created only after two consecutive pivots of the same type are confirmed (high-to-high or low-to-low). The script stores the price and bar index of these pivots and uses them as fixed anchor points.
Line Projection
Once a valid pivot pair is formed, the script draws a line between the two points using line.new() and extends it forward using extend.right. These lines represent projected structural boundaries rather than trade signals.
Object Management
To maintain chart clarity and performance, the script manages all drawn objects through a line[] array. A FIFO (First-In, First-Out) method is applied so that only the three most recent structural lines remain visible. Older lines are automatically deleted as new ones are created.
DESIGN PHILOSOPHY & ORIGINALITY
While many indicators plot frequent swing points or short-term pivots, Structure Lite focuses on structural persistence. By filtering for higher-period pivots and limiting the number of displayed projections, the script emphasizes dominant market structure rather than short-term fluctuations. This approach is intended to support discretionary analysis, not replace it.
HOW TO USE
Major Pivot Lookback
Increase the value to focus on higher-timeframe structure (e.g., swing or position trading).
Decrease the value to visualize intraday structural levels.
Visual Encoding
Green lines represent projected structural support
Red lines represent projected structural resistance
Visibility Control
A boolean input allows all structure lines to be hidden instantly to restore a clean price chart.
LIMITATIONS & DISCLAIMER
This script is a visualization tool only. It does not generate trade signals, entry or exit points, alerts, or directional forecasts. All plotted levels are derived from historical price action and may change as new pivots form. The script is provided for educational and analytical purposes and should be used in conjunction with other forms of market analysis
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.