RSI Trendlines with Breakouts

RSI Trendlines with Breakouts

1. Introduction

The RSI Trendlines with Breakouts (HoanGhetti) indicator combines classic RSI analysis with dynamic trendline detection to highlight potential reversal and continuation points directly on the RSI pane. By plotting trendlines through successive RSI pivots and marking clear breakouts with arrows, it helps traders spot momentum shifts earlier and more objectively.

2. Description & Fundamentals

  • Relative Strength Index (RSI): A momentum oscillator measuring speed and change of price movements on a scale of 0–100. Traditionally, readings above 70 indicate overbought conditions; below 30, oversold.

  • Pivot Points in RSI: Local highs and lows in the RSI series, detected over a configurable look-back period. These serve as anchors for drawing trendlines.

  • RSI Trendlines: Lines connecting two consecutive pivot highs (for a downtrend) or pivot lows (for an uptrend). A breakout of these lines often precedes notable price moves.

3. How It Works

  1. Pivot Detection:

    • The script scans the RSI (14) values over the last BarLookBack = 8 bars.

    • When the current RSI equals the highest (or lowest) value over the look-back window, it registers a pivot high (or low).

  2. Trendline Construction:

    • Maintains two arrays ($plx/$ply for lows, $phx/$phy for highs) storing the bar indices and RSI values of the last two pivots.

    • Calculates the slope-intercept form:

      y=y1+(x−x1) y2−y1x2−x1

    • Draws the segment only if it confirms a valid uptrend (pivot low2 > low1) or downtrend (pivot high2 < high1).

  3. Breakout Signals:

    • Bearish Breakout (Red): When RSI crosses below the up-trendline minus RSIdiff = 2, it drops a red down-arrow above the RSI pane.

    • Bullish Breakout (Green): When RSI crosses above the down-trendline plus RSIdiff, it plots a green up-arrow below the RSI pane.

    • After signaling, the trendline is extended in dotted style to the breakout bar.

4. Signal Interpretation

  • Red Down-Arrow (Sell Signal):

    • RSI has failed to maintain its uptrend and closed beneath the trendline by at least RSIdiff points.

    • Suggests weakening momentum—consider tightening stops or initiating short positions.

  • Green Up-Arrow (Buy Signal):

    • RSI recovers above its down-trendline by at least RSIdiff points.

    • Indicates renewed buying pressure—potential long entries or add-on opportunities.

  • Notes & Caveats:

    • Trendline breakouts can give false signals in choppy markets; combine with price action or volume filters.

    • Best used on well-defined trending instruments or timeframes where RSI reliably oscillates.

5. Configuration & Parameters

Parameter Default Description
BarLookBack 8 Number of bars to look back for pivot detection. Smaller values detect tighter swings, more noise.
repaint 0 When set to 1, pivots are identified with a delay of BarLookBack bars (not recommended).
RSIdiff 2 Minimum distance (in RSI points) beyond the trendline required to trigger a breakout arrow.
  • Adjusting BarLookBack:

    • Increase (e.g. 10–14) on higher timeframes to smooth trendlines.

    • Decrease (e.g. 5–6) on intraday charts for quicker signals.

  • Tweaking RSIdiff:

    • Larger values (3–4) reduce false breakouts but may lag.

    • Smaller values (1–1.5) catch earlier moves at the expense of more noise.

6. ProBuilder Code

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

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar
Related users ' posts
Simba Greetings from germany! :) Can you told me your EXIT-strategy for this, please? :) Would ...
Spawn Voici une version améliorée qui tient compte de plus de critères, notamment l'intégration de...
Etienne Hi, thanks for proving this code. I would like to contribute by adding a computation speed...
Etienne //Compute Super Smoother coefficients once if barindex = 1 then a1 = exp( -1.414 * 3.14159...
Nicolas Thanks a lot!
Eric If you have a high percentage winners and the trades are closed with take profit the spread ...
Casenova I Agree with you JaunJ, and Yes Eric, what you say makes sense too. Optimizing the Stop Loss...
ET Thanks for the system Casenova. In determining the high of the past 4 bars, is there a reaso...
ak5hay2 Works like crazy on bitcoin. Use different timeframes. Thanks a lot Doc!!!
richyowen Hi, great code thanks. Very new to this forum. Is there a way to add a 100point target on an...
lisamitch50 Morning all, Just backtested on quite a few instruments, worked well on backtesting, but tel...
Matriciel
7 years ago
Alai-n Thanks...
Bard Thanks for sharing this Verdi55. More instructions from Larry Williams website (and a fea...
reb Hello have you used this strat since last year ? live or Back test ? What are the results ?
beeb Yes last Year. But only back test
drysheep Hi all, did anyone test this strategy recently? As i dont get a single trade in the backt...
Nicolas
7 years ago
Nicolas Merci, faire une demande dans le forum approprié.
Pere Thanks for this good indicator Nicolas. I would like to make the upper and lower limits mor...
Nicolas because fractals are known 2 bars later! that's why I used rectangle to plot them in the past.
Nicolas
7 years ago
Jurik RSX
v10.3
Jurik RSX
3
Indicators
hartgeld Hallo Nicolas, ein sehr guter Indikator, vielen Dank! Leider rechnet er bei mir nicht die Pe...
rigel Hi Nicolas, have you coded the Jurik alone (as Mov. average)?
Nicolas 2 versions available in this indicator: https://www.prorealcode.com/prorealtime-indicators/a...
AG1 Thanks Nicolas Still a problem in line 29 Please take a look. thanks again Alex
Nicolas code is modified in the above post, use that one.
AG1 Still a problem in line 29 Please take a look. thanks again Alex
styrke Hello Nicolas, Nice screener, I appreciate the way you always try to condense at maximum th...
Nicolas There's no particular reason. RSI is widely use with its default period and results seems re...
Vonasi The indicator code can easily be adapted for use as a filter in strategies as well. For exam...
AVT Tested today in manual DAX trading (transcripted to MT and changed look into aka oszillator)...
Vonasi I think that short time frame charts will be too noisy for this indicator. One blue bar real...
Vonasi I forgot to mention in the description that Sunday pivot lines are ignored and Monday's pivo...
AVT Like that, simple and clear!
Vonasi Thanks AVT. I like simple - some people would say that I do simple very well! Sometimes you ...
MaoRai54 Hi, first of all Happy New Year. Well, I've inserted your indicator in DAX 1h but I cann...
Vinks_o_7 Hi Mao Happy New Year ! This is just an improved RSI where you plot a standard price momen...
Angel Perez Ciao Francesco. First of all thanks for the indicator and also fro the screener. I do have a...
PSIDIO Ciao to you all, I also have a question and would be very happy for a helpful comment. I a...
SpreadBetMH Hi there, I have V11.1. I get the Indicator but no Arrows on the price. Kind Regards...
Alai-n Ciao Francesco, sei ancora in giro?
Metodi97 This indicator is great but can someone create strategy based on the same indicator it will ...
Nicolas
8 years ago
TradeNavigator RSI
TradeNavigator RSI
10
Indicators
Nicolas Tutte le impostazioni che hanno la parola "period" sono quelle dedicate ai periodi di cambio...
GianfrancoCeck Le chiedo una ultima cosa, ossia se è possibile personalizzare l'indicatore con una scritta ...
Nicolas Spiacente che non sia possibile, le coordinate grafiche non sono in pixel ma nel prezzo e ne...
Alai-n Merci pour ce travail...
patmaba merci Alai-n. C'est ma première participation sur prorealcode, merci pour à toi pour ton co...
longtrade Can this be converted to a screener?

Top