Pivot Trendlines with Breaks
Mar 21, 2023

The Pivot Trendlines with Breaks indicator automatically identifies significant market structural shifts by plotting dynamic trendlines based on pivot points and highlighting breakout signals. This tool leverages a sophisticated pivot detection system to help traders visualize trend exhaustion and potential reversals through automated breakout detection and trendline tracking.
Usage
The Usage section focuses on identifying trend shifts using pivot-based geometry. Users can monitor the interaction between price action and the generated trendlines to anticipate market reversals.
- Breakout Identification: The indicator plots "Br" labels when price crosses a trendline. A bullish breakout occurs when price closes above a descending resistance line (derived from pivot highs), while a bearish breakout occurs when price closes below an ascending support line (derived from pivot lows).
- Trend Confirmation: By adjusting the Pivot Length, users can filter for short-term fluctuations or long-term structural trends. A higher length results in more significant, albeit fewer, trendlines.
- Target Levels: When enabled, the script projects horizontal target levels from identified pivots, providing potential take-profit or support/resistance zones after a breakout occurs.
Details
The script utilizes the Simple Trendlines library to handle the complex mathematics of line placement and projection. It calculates pivot points to identify local market highs and lows where the market attitude typically shifts.
The internal logic features a "strict mode" system that prevents line leakage, ensuring that trendlines are only drawn between valid pivot events. The breakout system detects price crosses relative to the trendline's current Y-value. Depending on the settings, these crosses can be calculated using the closing price or a user-defined source. To ensure data integrity, the script includes a repainting toggle; when disabled, the script waits for bar confirmation before confirming a breakout or trendline shift.
Settings
- Pivot Length: Determines the number of bars required on each side of a high or low to qualify as a pivot point.
- Pivot Type: Switches between "Normal" (Pine Script built-in system) and "Fast" (custom system tracking every reversal).
- Repainting: Toggles whether the script updates in real-time or waits for the bar to close to confirm signals.
- Target Levels: Enables the plotting of horizontal price targets derived from the pivot points.
- Bear/Bull Breakout Colors: Customizes the visual color for bearish and bullish trendlines and labels.
- Extend: Controls the horizontal extension of the trendlines (None, Right, Left, or Both).
- Trendline/Target Style: Adjusts the visual appearance of lines (Solid, Dashed, or Dotted).
- Override Source: Allows the user to select a specific price source (like Low or High) for pivot calculation instead of the defaults.
- Use Source for Cross Detection: When enabled, the script checks if the specified source—rather than the Close—has crossed the trendline for breakout confirmation.
FAQ
How do I adjust the sensitivity of the breakout signals? You can adjust the "Pivot Length" setting; a smaller value increases sensitivity to local price movements, while a larger value focuses on major market structures.
What is the difference between "Normal" and "Fast" pivot types? "Normal" uses the standard built-in pivot calculation requiring a look-back and look-ahead period, while "Fast" uses a custom logic designed to track reversals more aggressively.
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 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.