RSI and Linear Regression trading signals

RSI and Linear Regression trading signals

Trading signals based upon a linear regression channel applied to a classic RSI indicator.

If the RSI exceeds the upper band, the price should reverse to its mean and therefore a sell signals is announced.

If the RSI breaks the lower band, the price should reverse to its mean and a buy signals is plotted on the indicator.

You can adjust the RSI period of calculation (with variable ‘len’) and the linear regression channel period with “period”. The upper and lower band spread can be adjusted with the “deviations” setting (default is a 2 times multiplier from the mean).


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. Demon • 364 days ago #

    On this way of exploiting the RSI, read the article by Samuel Rondot:
    Thanks .
    How can I made a difference betteen the high and low deviation?

    • Nicolas • 363 days ago #

      In this article, the author uses the standard deviation from the mean of the RSI, in this case this indicator is not the same, use this one instead:

  2. Abz • 362 days ago #

    Hello ,
    is it possible to use this in a MTF screener without getting this fault?

    This ProScreener market scan cannot be executed because there is an infinite loop within the program code.
    An infinite loop is a sequence of instructions which repeats itself endlessly when the code is executed. This may happen if:
    – the loop doesn’t have a termination condition
    – the termination condition can never be met
    – the termination causes the loop to start over
    To run the scan, modify the code of your ProScreener.

    • Nicolas • 362 days ago #

      Sure, please open a new topic in the ProScreener section of the forum for that specific query. Please respect the posting rules also. Thanks.

  3. Sofitech • 356 days ago #

    I try to ad this indicator on DAX or EurUSD on M5 and on tick chart but nothing appears on the price chart. What can be the problem ?

    • Nicolas • 356 days ago #

      Try to expand the units displayed on your chart. Or use this simplified code which is the same:

  4. bearbull • 348 days ago #

    how would one incorporate an alarm at the buy/sell signal?

    • Nicolas • 348 days ago #

      Change the last line with: return irsi, a coloured(r,0,b) style(line,3) as “curve low”,c1 coloured(r,0,b) style(line,3) as “curve”, b coloured(r,0,b) style(line,3) as “curve high”,up,down
      and use the alert tool from the platform with “up” and “down” returned signals.

  5. bearbull • 348 days ago #

    Thank you sir!!

  6. bearbull • 348 days ago #

    Nicolas…….does this mean that I will now automatically have an alarm on every buy/sell signal? or will I have to manually reset it for every buy/ sell signal?

  7. bearbull • 348 days ago #

    ….also note in the alarm settings that for this indicator you cannot get an email email notification?

    • Nicolas • 348 days ago #

      email notification are not available for custom indicators.

  8. HappyBunny • 348 days ago #

    You are using variables “r” abd “b” for the color red and blue but unfortunately after setting r or b to 255, you reset b with
    b = startingPointY+deviation
    Do you rely on prorealcode knowing difference between integer b (255) and floating point b (deviation), or was this a mistake?

    • Nicolas • 348 days ago #

      good spot! indeed, that’s a mistake. Change the variable name for the b color, while I don’t think it would change the calculation result of the indicator itself.

  9. DIOS • 320 days ago #

    Bonjour Nicolas, comment coder un indicateur de rsi de Divergence? Merci pour ta réponse

    • Nicolas • 320 days ago #

      En apprenant la programmation 🙂 Plus sérieusement, il y a quantité d’exemples dans la library et dans les forums.

  10. DonTony • 185 days ago #

    Bonjour Nicolas,
    Très bel indicateur! Bravo!

Register or


avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+1 more likes

Related users ' posts
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. ...
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...
dudley10wise I tried loading it but it gives me an error on line 71 is there a fix, tried both downloads ...
venugopal Hi Nicolas, Thanks for this code. Is it possible to build a screener using this indicator?. ...
Nicolas It has been done in that topic. Enjoy.
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...
superprof salut merci pour ton indicateur. Pour bien comprendre , si suis acheteur à quelle comment j...
Nicolas A discrétion, bon courage dans ton apprentissage du trading.
Manu L. Bonjour Nicolas, j'ai créé un screener avec l'aide à la prog en TF weekly mais je voudrai...
ialaoufadia Je viens de comprendre l'origine de mon problème : le graphique n'avait tout simplement pas ...
ialaoufadia Merci Nicolas, le problème était donc autre.
Gianluca Sorry but the stochastic part should be different: sto=Stochastic[14,1] stod=average[3](sto)...
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
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.
woktrade Superbe !
Vonasi An updated version with a bug fix can be found here:
snucke hey Vonasi is it possible you can help me get this indicator to show how much a market mo...
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...
max-trading Bonjour, C'est bizarre, quand j'installe cet indicateur mon graphique des prix se resserr...
Nicolas Dans les paramètres du prix, il faut choisir la mise à l'échelle basée sur le prix uniquement.
Nick FX Junkie Good evening all, Is there any way this indicator can be transferred into a strategy code?
2 years ago
Wolf Compilation by sinusoid concept is very interesting. Thanks
groen200 Hi Zigo can you make backtest from this indicator
rosario Good evening I would like to understand why it doesn't work for me. Rosary
Denis Hello Nicolas, Thank you and congratulations for your work. The entry signals seem interes...
mia Bonjour j'arrive pas a integrer l'indicateur sur mt4 comment faire svp mercii
Nicolas Il ne s'agit pas d'un indicateur MT4, je vous suggère d'utiliser ProRealTime qui est une mei...
Dong Kobe THANK YOU Nicolas
leoulve Hello. I placed it on the price chart and nothing appear. Did I make a typical mistake? Merci
Nicolas No mistake, few signals.
Sapo Thank you very much. as always your indicators are extremely effective. kind regards Vonasi.
mitsu21 Hi, it looks nice. I'll try it tomorrow thank you for your share kind regards bruno
kj1988 Thank you Vonasi for sharing this indicator. Very useful as a comfirmation to the price act...
Dom Hello, commence le trading et découvre par la même occasion le ce n...
Nicolas Merci, ça fait plaisir !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
ggolfet Thanks Nicolas, I imported the itf file and solved the problem.
Hasardeur Hallo Nicolas, i tried to code the multi period heat map in combination with the Ehler’s ...
Nicolas Please open a new topic with the code in forum.
SB-FO Nicolas, can you share with me how PRT calculates LinearRegression ? Is it (3 * WeightedAve...
Nicolas The above code is the way it is calculated in PRT. However the exact indicator can be found ...
SB-FO Thanks Nicolas.
Marie-Eve Vergoz lorsque je copie les codes, le système me signale des erreurs à la ligne 12 et suivantes
Marie-Eve Vergoz sorry - tout est ok -