Trend Lines (HTF)
May 7, 2026

The Trend Lines (HTF) indicator automatically detects and projects trend lines from higher timeframe pivots onto your current chart to visualize structural support and resistance. It provides a multi-timeframe perspective by connecting recent swing highs and lows, allowing traders to monitor high-level trends without manually switching charts.
Usage
The Usage section describes how the script can be used to identify key market structure levels across different time horizons. This tool is primarily used for identifying trend direction, potential breakout points, and areas of role reversal.
- Trend Identification: The indicator draws resistance lines (connecting swing highs) and support lines (connecting swing lows). The slope of these lines represents the current trend momentum for each selected timeframe.
- Breakout Monitoring: When price closes through a projected trend line, the line is marked as "broken." This is visually represented by the line turning gray and dashed, signaling a potential shift in market structure.
- Role Reversal: Broken lines remain on the chart as dimmed, historical context. This helps traders identify "S/R flip" zones, where former resistance may become new support or vice versa.
- Multi-Timeframe Analysis: By default, the script tracks three different higher timeframes (e.g., Daily, Weekly, 3-Month). This allows a day trader to see weekly and monthly trend lines directly on a 5-minute or 15-minute chart.
Details
The script utilizes request.security to run a pivot detector on up to three user-defined higher timeframes. It captures bar timestamps for every pivot, ensuring that trend lines remain anchored to absolute time and do not drift when zooming or scrolling.
Lines are drawn between adjacent pivots (e.g., the most recent pivot and the one immediately preceding it). This design focuses on the most current swing slope rather than a "best-fit" line across many touches. The indicator updates on every tick of the live bar to ensure right-edge price labels reflect the most accurate projected levels. Older lines are progressively faded to maintain chart clarity, while broken lines are automatically restyled to indicate they are no longer active.
Settings
Timeframes
- Timeframe 1/2/3: Sets the higher timeframes from which pivots are pulled.
- Per-TF Pivot Lookback: The number of bars required on each side to confirm a swing. Higher values capture major structural moves, while lower values capture more frequent, minor swings.
- Resistance / Support lines per TF: Determines how many historical trend lines are displayed per timeframe for each direction.
Display
- Display Toggles: Individual switches for TF1/2/3 visibility, resistance/support lines, broken lines, pivot anchor markers, and right-edge price labels.
- Colors: Customizable colors for each timeframe and a dedicated color for broken lines.
- Line Widths: Independent thickness settings for each timeframe.
- Extension: Options to extend lines to the Right, Both directions, or None (segment only).
- Line Style: Choice of Solid, Dashed, or Dotted for unbroken lines.
FAQ
How do I interpret the different colors and line styles on my chart? Each timeframe is assigned a unique color and width. Solid lines of these colors represent active trend levels. Once price closes past a line, it turns gray and dashed, indicating it is a broken level that may now act as historical context or a role-reversal zone.
Why does it take time for a new trend line to appear? Trend lines are anchored to pivots, which require a "lookback" period to confirm. For example, if your lookback is set to 3, a pivot (and its resulting trend line) cannot be confirmed until 3 bars have passed on that specific timeframe.
How can I access the Trend Lines (HTF) indicator? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.