TrendLines with Alerts

Nov 29, 2019

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

The TrendLines with Alerts indicator provides an automated approach to identifying and plotting dynamic support and resistance levels based on price action geometry. It aims to simplify trendline analysis by calculating specific angles from local peaks and troughs to project future price targets and potential breakout zones.

Usage

The script can be used to identify trend direction and potential reversal points. It automatically plots upper (resistance) and lower (support) trendlines based on high and low pivot points defined by the user settings.

  • Trend Identification: When the price is consistently reacting to the lower trendline, it indicates a bullish support structure. Conversely, reactions to the upper trendline indicate bearish resistance.
  • Breakout Trading: The indicator generates buy and sell signals based on crossovers or specific price interactions with the projected lines. For example, a "Buy" signal may appear when price crosses over a projected upper trendline or maintains support at a lower trendline.
  • Refined Projections: The script uses an "extend" logic to project trendlines forward, allowing traders to anticipate where price might encounter friction in the future.

Details

The script operates by finding the highest high and lowest low within a specified lookback period ("Length 1"). It then uses a "Check" parameter to confirm these pivots. Once a pivot is confirmed, the script calculates the slope (angle) between the current pivot and the previous one.

This slope is then used to project the line forward. Unlike standard linear regression lines, these lines are anchored to specific price extremes, making them more reactive to recent price volatility. The script has been updated to Pine Script v6 to ensure compatibility with modern charting features and includes built-in strategy logic for backtesting entry and exit conditions.

Settings

  • Length 1: Determines the lookback period for identifying the highest highs and lowest lows.
  • Check: Sets the offset used to confirm a pivot point and calculate the trajectory.
  • Take Profit (%): The percentage-based target for the built-in strategy component.
  • Stop Loss (%): The percentage-based risk limit for the built-in strategy component.
  • What trades should be taken: Filters the strategy to execute "LONG", "SHORT", "BOTH", or "NONE".
  • Initial Stop Loss/Target Profit Points: Allows for point-based exit conditions instead of percentages.
  • Backtest Period: Inputs to define the specific start and end dates for the strategy performance report.

FAQ

How do I use the signals from this indicator?

The signals (Buy/Sell shapes) are generated when price interacts with the calculated trendlines. Traders often use these as confluence for existing strategies or as standalone breakout/rejection alerts.

Can I adjust the sensitivity of the lines?

Yes, by modifying "Length 1" and "Check," you can make the trendlines more or less responsive to short-term price fluctuations. Smaller values result in tighter, more frequent trendlines.

How can I access TrendLines with Alerts?

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.