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 • 09/25/2020 #

    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 • 09/25/2020 #

      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 • 09/25/2020 #

    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 • 09/25/2020 #

      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 • 09/25/2020 #

    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 • 09/25/2020 #

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

  4. bearbull • 09/25/2020 #

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

    • Nicolas • 09/25/2020 #

      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 • 09/25/2020 #

    Thank you sir!!

  6. bearbull • 09/25/2020 #

    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 • 09/25/2020 #

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

    • Nicolas • 09/25/2020 #

      email notification are not available for custom indicators.

  8. HappyBunny • 09/25/2020 #

    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 • 09/25/2020 #

      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 • 09/25/2020 #

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

    • Nicolas • 09/25/2020 #

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

  10. DonTony • 09/25/2020 #

    Bonjour Nicolas,
    Très bel indicateur! Bravo!

  11. manafull • 132 days ago #

    Awesome work Nicolas! By any chance, do you have the Screener version for this “RSI and Linear Regression trading signals”. I tried to convert the indicator to screener by replacing the drawing at the end i.e. “SCREENER[Signal](Signal AS “1=↑, 2=↓”)”, where I use the Signal =1 or 2 to replace the two condition of drawing in the codes … but at the end I always get the error “Syntax error: This variable is not used in the {did not show any further info}”. It would complete your indicator perfectly if you can add the screener here for us. Thank you and Best regards.

    • Nicolas • 131 days ago #

      Please open a topic in ProScreener forum with your query, I’ll reply you there. Thank you.

  12. manafull • 130 days ago #

    Thanks Nicolas, I post my question, along with the codes I am trying to convert from your indicator, in the ProScreener Forum… So please review there. Thanks again.

    • Nicolas • 129 days ago #

      I replied to your post here:

Register or


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

+3 more likes

Related users ' posts
6 days ago
Matriciel Very nice job ! Is it possible to do the opposite because what interests me is to have the ...
YvesRobert Hi Matriciel, how can we do this, because stochastic is limited between 0 and 100 but price ...
jacquesgermain Hello IASD it's normal , when this occurs, uncheck RSI and MFI line and click then the MAC...
emiliobercial Thank you very much for sharing!
Carlose estoy de acuerdo con IASD Esta muy bien el MAD y el indicador en el precio no se ven bien...
kvacksa87 Går det att göra något automatiskt script till signalerna ?
Nicolas Simple strategy with this indicator is available here:
FXtonio Nicolas.... MERCI 1 millions de fois, cet indicateur gagne dans 75% des cas en scalping m1 ...
bousalahane merci pour le partage de cet l'indicateur, j'ai rajouté un autre indicateur pour faire une s...
5 months ago
yassinoumas33 how to add this indicator to mt4 please
Nicolas You can't, all codes shared here are to be used with ProRealTime trading platform: https://t...
doo23559 Brother , It`s not work . I want to be auto trade based on the signals
KumoNoJuzza Hi Guys. This looks very interesting but don't overnight fees kill the profit when trading o...
ThaNoizy Yes, you cannot use CFDs on IG for Weekly strats you need to use their Index Futures, they h...
KumoNoJuzza Thanks. I did not know IG had Futures. I am always missing an info or a detail. I used to th...
FXtonio @RICOU en 1 minutes avec un filtre de tendance ZLSMA 200 et eventuellement un rsi 7 , 69% de...
JC_Bywan For people interested in the screener:
octum Gracias NJicolas. Las lineas 35 y 36 dan fallo. (¿Es adrede para iniciados?) Puedes co...
8 months ago
Violet Nicolas, you calculate iRSI, but don't use it. You show RSI in the returned values, which, a...
Nicolas Yes, that's an error. RSI instruction is set by default to 14 if you don't indicate it that'...
YvesRobert Bonjour Nicolas, concernant cet indicateur j'ai voulu l'utiliser mais il commence à tracer l...
Nicolas Je ne rencontre pas ce problème avec le NASDAQ par exemple, ce serait plus simple d'ouvrir u...
YvesRobert Bonjour Nicolas, en effet ca marche, je me suis trompé, j'ai bien tout le tracé. C'est parce...
DELBERT Bonjour , Nicolas , je voudrais installer cet indicateur sur ma PRT , version 10.3 , mais je...
Nicolas En effet, il faut à minima une version 11. La 10.3 est tellement ancienne maintenant.. Je pe...
DELBERT Bonjour , Nicolas , merci pour ta réponse , je fais un essai et je verrais . Salutations .
Khaled Thank you Nicolas! Looks like TDI (Trader Dynamic Index). Interesting to give Exit Signal as...
Nicolas ColorBetween is an instruction added last year:
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...
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.
Abouadam2 EFFICACE
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...
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 à ...