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
Related users ' posts
AntoGH Bonjour peut-on backtester cela ? Et si vous l'avez fait pourriez vous nous donner le code.....
Nicolas désolé c'est un oubli de ma part, tu peux supprimer cette ligne, elle n'est plus utile dans ...
DELBERT Bonjour , Nicolas , merci pour ta réponse , je suis en effet avec PRT 10.3 , et j'ai bidouil...
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 ...
supertiti https://zupimages.net/viewer.php?id=20/50/2e3v.jpg
volanirina Bonjour Je souhaite l'avoir sur l'indicateur MT4 si possible s'il vous plait. car je l'ai fa...
Nicolas ProRealCode est un site dédié à l'utilisation de la plateforme de trading ProRealTime: https...
IV Mcm I don't speak English and the translation is not clear. Do you have a different turn of ...
IV Mcm stonk ?
avatar
Anonymous Thanks very much for sharing, look forward to testing this idea out.
Noobywan (My apologies for unformatted code, the formatting only works in forum or library posts not ...
Noobywan Hi FXTT, no problem for requests (as long as no one requests me singing), just usually it’s ...
JC_Bywan Bug fix at line 38, should be: if changebarre or (opentime[1]=start) then (same as in ...
Manu L. Bonjour Nicolas, j'ai créé un screener avec l'aide à la prog en TF weekly mais je voudrai...
wtangsiri C'est exactement le même signal que donne le croisement et le décroisement de deux EMA (7 et...
PHAN100 bonjour, j'ai un bug sur le programme recopié prorealtime me dit qu'il y a un problème à ...
PHAN100 bonjour, bravo à l'auteur pour cet indicateur visuel sur le graphique, il nous reste à va...
Pensera Bravo Nicolas ! Tu es en quelque sorte l’inventeur de Metascore…(oups je viens de lire jusqu...
Nicolas Dans un but d'investissement pure, et non spéculatif.
Enigma08 Hi Juanj. I am new to ProrealTime and I am trying to program the Proscreener. I want the Pro...
Nicolas Please open a topic in ProScreener forum with your query, I'll reply you there. Thank you.
manafull Thanks Nicolas, I post my question, along with the codes I am trying to convert from your in...
Nicolas I replied to your post here: https://www.prorealcode.com/topic/screener-for-rsi-and-linear-r...
Madrosat I Have not see a fully functioning automated strategy on your site?? Really have you???
juanj Hi Madrosat, why would it be on my site? I have developed it for my personal use and also to...
Madrosat ok I understood you are using prorealcode to hack the fish
yeoreum Thank you very much for the screener, it reminds me on Minervini VCP. How to change th...
reecet any codes like this but in minutes and hours rather than days?
PHAN100 bonjour, je viens de tester ce screener, je constate une anomalie...il ne renvoie pas l'e...
imonix Have been trying this on demo since Monday before deciding whether to go live with it. Using...
Roberto Blázquez I'm sorry, I've tried it since November 2012 and it's bad results.
Oxxoz Re bonjour Vivien, Il me smeble que 3 mois, c'est 60 séances. Cordialement,
Vinks_o_7 thanks ...and It can be used on a monthly and weekly basis by changing just the duration in ...
nicko Many Thanks Viv. It looks good
Nokis Bonjour Vivien, Comment je peux faire pour adapter ton code afin: De cibler les sociétés q...
sam00075 I tried it today and it gave great results. So a big Thanks !
Nicolas Oui le code est correct et il fonctionne, j'ai de bons résultats sur la liste NASDAQ par exe...
pincherman Bonjour :-) J'ai coller le script dans prorealtime pour jouer avec le supertrend et j'ai un...
Nicolas Vous l'avez sans doute collé au mauvais endroit, dans l'éditeur de code pour les stratégies,...
Bard Hi @Vonasi, this is an excellent tool! I noticed you times by 180 and was wondering why? W...
Bard I have no idea what is wrong with the posting on this website. I have problems editing posts...
Bard And now my first post displays okay? It literally had copies of my orig post all added toget...
Vonasi An updated version with a bug fix can be found here: https://www.prorealcode.com/topic/dis...
snucke hey Vonasi is it possible you can help me get this indicator to show how much a market mo...
Patrick K Templar does need updateing for v12
Vinks_o_7 Vonasi you're a beast !!! ;-)))
pableitor Amazing indicator , you are pushing PRT to the limit! But looking at the scatter its not c...
carpentier Joffrey Bonjour à tous, Avant tout merci pour ce travail, cependant je suis bloqué quand je l'insta...
carpentier Joffrey Re, C'est ok, j'ai trouvé mon erreur... Cependant sur quel base peut on calculer son CALC...
Aragorna Hi Nicolas, How is it possible to use it in a higher timeframe plotted on a lower timeframe?...

Top