TrendLine BreakOuts

TrendLine BreakOuts

1) Introduction

TrendLine BreakOuts is a indicator inspired by the original concept created by ChartPrime. It automates the discovery of dynamic trendlines built from swing pivots and highlights the first valid breakout with clear, actionable visuals. Once a breakout occurs, the tool overlays ATR-based take-profit (TP) and stop-loss (SL) rails and tracks which level is reached first, helping traders evaluate follow-through after a structural break. Designed for clarity and speed, it works on any timeframe and instrument, and it offers flexible controls to switch between wick or body pivots and to enable/disable bullish or bearish structures.

2) How the Indicator Works

Pivot detection

  • The script scans left/right bars defined by period to confirm swing highs and lows.
  • pivottype = 1 → uses wicks (low/high).
  • pivottype = 0 → uses bodies (min(open, close) / max(open, close)).

A pivot is confirmed when the current candidate is lower (for lows) or higher (for highs) than the surrounding window on both sides. This ensures robust swing points and limits noise.

Trendline construction

  • Bearish lines are drawn by connecting two descending pivot highs (PH).
  • Bullish lines are drawn by connecting two ascending pivot lows (PL).
  • The slope is computed from the latest two relevant pivots and the line is projected forward bar by bar.

Breakout logic

  • For bullish setups (using pivot highs): the indicator checks when price closes above the projected line → breakout.
  • For bearish setups (using pivot lows): the indicator checks when price closes below the projected line → breakout.

On the breakout bar, the script establishes TP/SL levels and begins tracking which one is hit first.

Volatility engine (TP & SL)

  • The buffer Zband is derived from ATR(30) and the instrument price, then shifted and halved as used in the code.
  • TP/SL are placed symmetrically around the breakout reference using a multiplier (*20 in the script).
  • As bars evolve, the script checks: TP hit first (win) or SL hit first (loss).

Drawing layer (what you see)

  • Trendline segments to the breakout point.
  • ▲ / ▼ breakout icons at the crossing.
  • Dotted TP/SL rails that extend until the exit bar.
  • ✖ marker at the exact exit price (TP or SL first).

3) Inputs & Defaults (Configuration Panel)

Input Type Default What it controls Notes & typical ranges
period Integer 9 Swing width (pivot sensitivity) 6–20 common. Lower = more signals, more noise. Higher = smoother, fewer but stronger lines.
pivottype Integer 1 1 = wicks; 0 = bodies Bodies help reduce false breaks from wick spikes; wicks capture “true extremes”.
showtrendUP Boolean 1 Show bullish (breaks of descending highs) Set to 0 to hide all bullish structures.
showtrendDN Boolean 1 Show bearish (breaks of ascending lows) Set to 0 to hide all bearish structures.

Under the hood:

  • leftbars = period
  • rightbars = max(1, floor(period/2))
    This creates a forward/backward confirmation window around each candidate swing.

4) Signal Anatomy & Chart Markings

Bullish pattern (break above a descending line built from pivot highs):

  • Dark green trendline up to the breakout bar.
  • ▲ green marker at the breakout.
  • Green dotted line for TP and dark red dotted line for SL.
  • ✖ orange point at the exit (whichever is hit first), with a small green label.

Bearish pattern (break below an ascending line built from pivot lows):

  • Dark red trendline up to the breakout bar.
  • ▼ dark red marker at the breakout.
  • Green dotted line for TP and dark red dotted line for SL.
  • ✖ orange point at the exit, with a small dark red label.

Legend (quick view):

  • Trendlines: dark green (bullish), dark red (bearish).
  • Breakout icons: (up), (down).
  • TP: dotted (green).
  • SL: dotted (dark red).
  • Exit: (orange point + label).

5) Trade Management Logic

  • On breakout, the indicator computes TP and SL using the volatility buffer Zband.
  • It simulates the path bar by bar after the breakout: if TP is touched first, it registers a win; if SL is touched first, a loss.
  • The script draws until the first event occurs; if neither is hit by the current bar, the rails remain open to barindex.
  • islastbarupdate ensures drawing is efficient and that only relevant, up-to-date segments are output on the last recalculation.

6) Code (ProBuilder)

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. roccafragius • 15 hours ago #

    Great Indicator Ivan, thank you so much! It seems better than similar indicator that are available in the market 🙂

avatar
Register or

Likes

avatar
Related users ' posts
Nicolas
2 years ago
Maxime Baudin Well done Nicolas, creative!
Stenozar Hi Nicolas, please can you explain how to read/use this indicator? thanks!
octum Gracias NJicolas. Las lineas 35 y 36 dan fallo. (¿Es adrede para iniciados?) Puedes co...
mortezaali14 Salut Nicholas, comment exécuter ce fichier dans les métadonnées
Leduc71 Bravo ! Cet indicateur est un suiveur de tendance, type “stop and reverse”, inspiré des cana...
Nicolas Yes, Magic if the variable that contains the value of the line, you can test if it goes up o...
dadah1987 Bonjour Nicolas, merci pour cet indicateur. Utilisant pour l'instant la création simplifié p...
Nicolas Merci d'ouvrir un sujet sur le forum avec une description complète du système.
GustavoLoboOrenstein Is it possible to add histogram with only increasing bars?
YvesRobert Bonjour Nicolas, en effet ca marche, je me suis trompé, j'ai bien tout le tracé. C'est parce...
oliTR Bonjour, les conditions longCond et shortCond ne contiennent-elles pas une condition qui s'a...
xpe74 Utilitaire vraiment top, d'autant qu'ajouter des filtres de seuil peux aider a limiter le no...
Jiacky
3 years ago
Kalman Filter
Kalman Filter
0
Indicators
Stenozar Hi Sever, how can I visualize the coloured areas?
Sever Hi Stenozar, You need to add the color zones yourself , just go to Add Color Zone To set ...
YvesRobert Hi smp, how should I configure this indicator because everything is at zero -> High, Clos...
smp Hi, this is an end of day pivots indicator, so you need to find the end of day pivot info; t...
YvesRobert Thank you smp.
smp I also have an End Of Day (EOD) cash pivot indicator for use on cash markets; this indicator...
atlante hi nicolas this indicator have 2 wrong borderline and islalastbarupdate. thank you can you h...
Nicolas That'"s because you are not using PRT v11? Just remove lines 59 to 62
Kanamax Hi Roberto, sorry for my confusing previous posts (forget them). My request is very simple,...
robertogozzi Please start a new topic in ProOrder support.
robertogozzi There you go: myMagicTrend = CALL “Magic Trend custom”[20, 14, 1, 5] alpha = 105 b = 0...
johann8 exactly :) Thank you all for the help!
max_92 Ciao Roberto, ho scaricato l'indicatore e come ti avevano già scritto sopra anch'io vedo la ...
cdc.andersson Hej! Jag försöker lära mig att koda PRT. Jag vill testa en strategi med RSI-värde, ATR-värde...
Swingforfortune Du kan väl jämföra om open > close (röd) eller open < close (grön)
Xenotrax A première vue, sa à l'air d'être un indicateur très puissant sur de petites temporalités, j...
merri Bonjour Nicolas, Comment transformer cet indicateur en bot sur PRT ?
Nicolas Cela a déjà été fait, voir ce sujet: https://www.prorealcode.com/topic/strategia-con-lindica...
Nicolas change the last line with: return v coloured(r,g,b) style(line,2), v+band coloured(168,168,1...
Paolo.B Thanks ... works as i wanted.
Kanamax Bonjour Nicolas, comme Paolo.B je souhaiterais utiliser cette indicateur au sein d'un code. ...
zilliq Thanks @Nicolas. I tried to use it as Trend in a proorder system, but don't know why, it doe...
Suzu Yuk He is right. MT and mavgMT are not defined and causing errors.....
Roland57800 Bonjour Noobywan, si je comprends bien l'utilisation de ce code que je trouve particulièr...
Noobywan Bonjour, quand la question a été posée dans le forum à celui qui avait fait la requête en am...
Fabian This Code draws only a retangle if the condition has been confirmed and NOT before (in that ...

Top