Trend Lines, Supports and Resistances

Jan 3, 2024

Static chart image
Support and Resistance
Signals
Pivot Based (Retrospective)

The Trend Lines, Supports and Resistances indicator is a comprehensive charting tool designed to automatically identify and visualize critical price levels and trend trajectories based on pivot highs and lows. It helps traders distinguish between active market structures and historical zones by dynamically managing trend lines and support/resistance areas.

Usage

The script automatically detects pivots and uses them to construct two main types of technical analysis elements:

  • Trend Lines: The tool connects a user-defined number of pivot points to draw diagonal trend lines. It includes advanced filtering, such as "Maximum Violation," which allows lines to stay active even if price briefly breaches them, and "Excepted Last Bars" to prevent premature alerts or removals during recent volatility.
  • Support and Resistance (S&R): Horizontal zones are drawn based on pivot points. These boxes visualize the area between the candle wick and the body, providing a clearer zone of interest than a single line.
  • Alerting: Users can enable alerts for price breaking through trend lines or S&R levels. The frequency of these alerts (per bar, per bar close, or every tick) can be adjusted in the settings.

Details

The indicator relies on the calculation of pivots over a specific "Pivot Length." Once a pivot is confirmed, the script evaluates the relationship between historical pivots to form trend lines.

  • Trend Line Logic: It checks multiple point combinations to find the most relevant diagonal trends.
  • Violation Logic: The tool differentiates between "active" and "violated" lines. Users can choose to display violated trend lines as "ghost" lines (dotted) to see where previous market structures existed.
  • Box Implementation: Support and resistance levels are drawn using boxes that span from the pivot's extreme price to the nearest candle body, providing a volume-weighted sense of the level.

Settings

Pivot Points ・ Common

  • Pivot Length: The number of bars required on each side to confirm a high or low pivot.
  • Mark Pivots: Toggles the visual markers (shapes) on the chart where pivots are detected.
  • Alerts Enabled / Frequency: Controls the master alert toggle and how often alerts trigger for pivot detection.

Trend Lines

  • Enabled: Toggles the calculation and display of diagonal trend lines.
  • Points to Check: The number of historical pivots the script analyzes to find valid trend lines.
  • Maximum Violation: Sets how many times price can cross a trend line before it is considered broken.
  • Excepted Last Bars: Ignores violations occurring within the most recent "n" bars.
  • Show Violated Trend Lines: Displays broken trend lines as dotted "ghost" lines.
  • Line Extension: Sets whether the lines extend to the left, right, both, or none.

Supports & Resistances

  • Enabled: Toggles the horizontal S&R zones.
  • Points to Check: Number of pivots used to identify S&R levels.
  • Maximum Violation Allowed: How many times price can breach a horizontal level before it is removed.
  • Excepted Last Bars: Ignores breaches in the most recent bars to avoid noise.

FAQ

How do I use the "Maximum Violation" setting?

This setting allows you to filter out market noise. If set to 1, the trend line or support level will remain active even if the price breaches it once, only disappearing or turning into a "ghost" line after the second violation.

What are "Excepted Last Bars"?

This setting prevents the indicator from removing a line or triggering an alert if a violation happens within the most recent bars. This is useful for avoiding "false" breaks that occur during high-volatility price action before a candle closes.

How can I access this indicator?

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.