Auto Trendlines

May 5, 2026

Static chart image
Support and Resistance
Drawing Tool
Pivot Based (Retrospective)

The Auto Trendlines indicator automatically detects and plots diagonal trendlines based on pivot highs and lows to identify dynamic support and resistance levels. It provides a visual framework for understanding market structure by connecting significant price points and projecting potential future trend paths.

Usage

The Usage section describes how the script can be used to identify market trends and potential reversal points. The indicator classifies trendlines into two categories:

  • Bullish (Support): Connects ascending pivot lows. Price bouncing off these lines indicates a higher probability of trend continuation, while a close below may signal a weakening uptrend.
  • Bearish (Resistance): Connects descending pivot highs. Rejections at these lines suggest downward pressure, whereas a close above may indicate a potential breakout or trend shift.

The script uses a multi-length system (L1 and L2) to track short-term and long-term structures simultaneously. Confirmed segments are displayed as solid lines, while projected extensions appear as dotted lines, allowing traders to anticipate where price might interact with the trend in the future.

Details

The script utilizes a specific construction logic to ensure clean visual output and structural relevance:

  • Anchor Replacement: This feature automatically refines the starting points of trendlines. If a raw pivot connection results in a line cutting through price action, the script searches for a more extreme anchor to ensure the trendline remains technically valid.
  • Angle Filtering: To reduce market noise, the indicator calculates the geometric angle of each trendline. Lines that are too flat (sideways) or too steep (unsustainable) can be filtered out based on user-defined degree thresholds.
  • Dynamic Glow: A multi-layered linefill system creates a visual "glow" around the trendlines, representing a zone of influence rather than a singular price point.

Settings

Trendlines

  • Show Trendlines: Toggles the visibility of all trendline structures.
  • Bullish Color: Sets the color for ascending support lines.
  • Bearish Color: Sets the color for descending resistance lines.

Lengths

  • Show L1 / Length 1: Enables and defines the pivot lookback period for short-term trend detection.
  • Show L2 / Length 2: Enables and defines the pivot lookback period for long-term trend detection.

Detection

  • Anchor Replacement: When enabled, automatically adjusts trendline origins to prevent them from intersecting candle bodies.
  • Future Extension Bars: Determines the horizontal length of the dotted projected trendlines.
  • Break Bars Limit: Sets the number of bars a trendline remains visible on the chart after it has been price-broken.

Angle Filter

  • Use Angle Filter: Toggles the removal of trendlines based on their steepness.
  • Min Angle / Max Angle: Defines the specific degree range for trendlines to be considered valid.

Debug

  • Show Angle Label: Displays the numerical angle at the start of each line, assisting in the calibration of the Angle Filter.

FAQ

How do I adjust the sensitivity of the trendline detection? You can modify the "Length" settings in the Lengths group; smaller values detect more frequent, short-term trends, while larger values focus on major macro structures.

What causes a trendline to disappear or change? Trendlines are based on dynamic pivots; if the "Break Bars Limit" is reached after price crosses a line, or if a new, more relevant pivot is formed that replaces the current structure, the lines will update.

How can I access the Auto Trendlines tool? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free access on the following platforms
tradingviewSymbolTradingView
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

ninjatraderNinjaTrader
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

metatrader4MetaTrader 4/5
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

thinkorswimThinkorswim
Open in your browser

This in-app browser is not compatible with Get Access from the library.

Tap the menu (...) at the top of your screen and select "Open in Browser", "Open in Safari", or "Open in Chrome" to continue.

Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.

Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.

As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.

Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.

Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.

This does not represent our full Disclaimer. Please read our full disclaimer.

© 2026 LuxAlgo Global, LLC.