OPEN-SOURCE SCRIPT

Structure Lite - Automatic Major Trend Lines

160
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

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.