OPEN-SOURCE SCRIPT

Trendline Breakout Navigator [LuxAlgo]

14 608
The Trendline Breakout Navigator indicator shows three trendlines, representing trends of different significance between Swing Points.

Dots highlight a Higher Low (HL) or Lower High (LH) that pierces through the Trendline without the closing price breaking the Trendline.

A bar color and background color option is included, which offers insights into the price against the trendlines.

🔶 USAGE

istantanea

Trendlines (TL) are drawn, starting as a horizontal line from a Swing Point.

When an HL (in the case of a bullish TL) or an LH (bearish TL) is found, this Swing Point is connected to the first Swing Point. In both cases, the TL can be optimized when one or more historical close prices breach the TL (see DETAILS).

A solid-styled long-term trendline represents the overall market direction, while a dashed-styled medium-term trendline captures medium-term movements within the long-term trend. Finally, a dotted-styled short-term trendline tracks short-term fluctuations.

🔹 Swing Points vs. Trend

A "Higher High" (HH) or "Lower Low" (LL) will initialize a new trendline, respectively, starting from the previous "Swing Low" or Swing High".

To spot the trend shift, "HH/LL" labels and an optional background color are included. They can be enabled/disabled or set at "Long, Medium, or Short" term TL (Settings—"MS", "HH/LL" and "Background Color").

These features are linked to one Trendline of choice only.

istantanea

Where the "HH/LL" labels can show a potential trend shift, the background color is:
  • Green from the moment the close price breaks above a bearish trendline or when an HH occurs
  • Red from the moment the close price breaks below a bullish trendline or when an LL occurs


🔹 Bar Color

The bar color will depend on the location of the closing price against the three trendlines. When a trendline is unavailable (for example, if the close price breaks the TL and there is no HH/LL), the last known trendline value will be considered.

All three trendlines influence the bar color.

If the close price is above the "Long Term" TL, the bar color will show a gradient of green, darker when the close price is below the "Medium Term" and/or "Short Term" TLs.

On the other hand, when the close price is below the "Long Term" TL, the bar color will show a gradient of red, which becomes darker when the close price is above the "Medium Term" and/or "Short Term" TLs.

istantanea

To keep the above example simple, only the "Long Term" TL is considered. The white line (not included in the script) resembles the actual value of the TL at each bar, where you can see the effect on the bar color.

istantanea

Combined with the trendlines and dots, the bar color can provide extra depth and insights into the underlying trends.

🔹 Tested Trendlines

istantanea

If a new HL/LH pierces the Trendline without the close price breaking the Trendline, the Trendline will be updated.

The exact location where the price exceeded the Trendline is visualized by a dot, colored blue on a bullish trendline and orange when bearish.

istantanea

These dots can be indicative of a potential trend continuation or reversal.

🔹 Higher TimeFrame Option

istantanea

The "Period" setting enables users to visualize higher-timeframe trendlines as long as the line length doesn't exceed 5000 bars.

🔶 DETAILS

istantanea

When a new trendline is drawn, the script first draws a preliminary line and then checks whether a historical close price exceeded this line above (in the case of a bearish TL) or below (in a bullish case).

Subsequently, the most valid point in between is chosen as the starting point of the Trendline.

istantanea

🔶 SETTINGS

  • Period: Choose "chart" for trendlines from the current chart timeframe, or choose a higher timeframe


🔹 Swing Length

  • Toggle and Swing Length for three trendlines: Period used for the swing detection, with higher values returning longer-term Swing Levels.


🔹 Style

  • Trendline: color for bullish/bearish Trendline
  • Wick Dot: color for bullish/bearish trendline test

  • Term: Long-, medium- or short-term
  • HH/LL: Show HH/LL labels (with or without previous Swing High/Low) of chosen Term
  • Background Color: Green when the closing price is above the trendline of choice, red otherwise

  • Bar Color

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.