Linear Regression Channel with percent upper and lower lines

Linear Regression Channel with percent upper and lower lines

This channel is made of initial code by HK-LISSE to draw a linear regression. Coded by request, this modification is an attempt to draw the correct channel made with an upper and a lower lines deviated from the center by price percentage.

This code maybe of interest for anyone to make screeners and automated strategies around it, because there are no possibilities actually to call the values of the platform embedded same indicator.

Beware that the channel is moving at candle close and informations of the N+0 past channel would have not be the same in the past at N+10 periods for example.


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?

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

  1. volpiemanuele • 04/13/2016 #

    I tried to build a TS with this indicator but don’t run. The idea is to enter long when the candle crosses the lower channel and enter short when the candle crosser th upper channel. For exit rules I think it’s better when the price is > of channel center for long position and < of channel center for short position. I think to insert a stop loss equal to a % of ATR. I want to test it for a TF of 15 min. Can you aid me ? Tanks

    • Nicolas • 04/13/2016 #

      This indicator will not move with price since it’s build with future datas on its first load, sorry. This indicator is a kind of a trick to build lines on price chart while its not possible until version 10.3

  2. Gustaf • 04/13/2016 #

    Hello Nicolas!Thank you so much for sharing this code. However I can’t manage to get the indicator applied ONTO the price action. Instead, the indicator appears in a separate window below the price. Do you have any idea on how to fix this?Sincerely,Gustaf

    • Nicolas • 04/13/2016 #

      Hi Gustaf, look at this video tutorial to add and configure an indicator in Prorealtime :

    • Canale di Fill • 04/13/2016 #

      hi nicolas compliments are very good and really helpful , version 10.3 when it’s available ?

    • Nicolas • 04/13/2016 #

      version 10.3 beta is already available at

  3. Gustaf • 04/13/2016 #

    Thank you Nicolas.Now it works!

  4. HANTZ • 04/13/2016 #

    I am currently use this linear regression channel. I would like to add a additional linear regression channel with the same lenght but X periods before (like 3) in order to see the evolution of the channel?

    Thanks for your help!



  5. thomas2004ch • 04/13/2016 #

    Hi Nicolas,

    A very nice indicator. But I want to know how to calculate the correlation coefficient? It seems there is function called Correlation by ProRealTime?

    • Nicolas • 04/13/2016 #

      Pretty much the same as :

  6. €Ȝ • 04/13/2016 #

    Bonjour Nicolas,
    Is there a way to dynamically vary the length of this indicator in realtime and still get it to display? I am only interested in the most recent “len” setting and understand that the indicator will change but I am unable to do this dynamically.
    If I set the length to 20 and leave it there over the entire period of measurement it works perfectly but if I change the length variable dynamically it does not display anything… Can this be done somehow?
    The issue can be replicated by replacing “len=100” with the following code (which just simply alternates between a period of 50 and 100):
    Once Len = 100
    If Len = 100 then
    Len = 50
    Len = 100

  7. viktorthuns • 04/13/2016 #

    I wish to get a clearer unstanding of the theory behind this code. What does j=j+1 imply? Im going to start prorealcode but right now im switching between this and another programme where i need to translate the script but im having problems understanding the logic behind it. By the way, i love this indicator!

  8. Pere • 04/13/2016 #

    Hi Nicolas. In order to do tests, is there the possibility to set the start and the end of this channel, to see how it changes with the time? Now it’s only possible to define the start of the channel, because the end is always the last bar.

    • Nicolas • 04/13/2016 #

      I would not recommend using this version of the linear regression channel, but this one instead:
      This new one is the same as the default tool of the platform.

Register or


avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Maxime Baudin Thank you Vonasi
Vonasi An update to this indicator with some improvements and new features can now be found here: ...
JohnScher I'm sorry, I specialized in the Dax. I'm sure the basic idea of the strategy also works in t...
ALZ Hi Regarding the DAX, it's good too with 200k bars (with parameters of the basic idea) F...
Crystal Babe Hi John, this strategy is Great for DJI -justneededa bitof tweaking for the 1 hr chart. Tha...
Byggtrader Hi Nicolas! How do I get the indicator in the price chart? It only stays under i new chart.
Nicolas Just add it on the price chart by using the wrench on the left upper side of the chart (pric...
jobswaps oyes aste uno de soportes y recistencias
jobswaps eso lo necesitamos
swapping Excellent Nicolas ;)
Violet Hi Nicolas, There seems to be a small error in the code, which causes the channel not to...
Nicolas Hmm, I don't think so, otherwise the channel will have a moving start and not anchored anymo...
Nicolas I don't know, that code is a 1:1 translation from another platform.
jm1111enator Hello Nicolas, Is this a conversion from Tradestation Easy Language? If so, do you have a ...
Nicolas Sorry I do not provide assistance for Tradestation code.
Santi Salut, les amis. L'indicateur avec la nouvelle version de PRT 11 fonctionne très mal, ne fon...
oeil62 Bonjour quelles sont les valeurs des variables pour une utilisation journalière ? merci pour...
ALE As soon as the final version of ProRealtimeV11 is released, I will check for any changes to ...
Nicolas Just add a linear regression moving average of 200 periods on the chart and you'll get the s...
Partha Banerjee Hello Nicolas, this is great, however the actual PRT standard error and standard deviation c...
Nicolas If you want to anchor the channel to a specific candlestick, that would be possible but with...
sir_i Bonjour à tous, Je suis nouveau sur le forum et sur la plateforme, pourriez-vous me dire com...
Nicolas Il faut simplement l'appliquer sur le prix.
sir_i Merci pour la réponse, je ne suis pas familier avec l'application de cette procédure simple,...
Choliver Bonjour et merci pour cet indicateur. Toutefois, il me semble qu'il est unidirectionnel. P...
Louis Winthorp III Hi Choliver, you are right, there is a problem with the drawing instruction when the slope i...
Nicolas File and code are updated.
Nicolas In the indicator's settings window.
Tarkus1954 Hi. When I add this indicator it loads it in a separate window. How do I get the indicator...
Nicolas By adding it on the price chart. Use the wrench on the left upper side of the price chart.
cfta Hi Fulvio, many thanks for sharing this clever indicator, much appreciated. As Pepsmile ment...
cfta Sorry adding the PRT to code didn't work in the above comment so I guess we will have to set...
juanj Something appears to be wrong with this formula as graphing t shows t to almost never be wit...
Nicolas Agréguelo a la tabla de precios usando el botón de configuración de precios en la tabla.
Traderfox06 Dear Nicolas, I believe in the high potential of quadratic regression for an automated sy...
Nicolas S11 variable is not a loop but a ratio calculation. In real time the codes is processed on e...
Canale di Fill By Filippo si si... farò un video a breve
AngelPujalt ok. Gracias.
Stenozar Hi Filippo, any news about your video to explain how to use this indicator? thanks
Gianluca Hello Nicolas, my prt become stuck when i load the indicator, is there any problem with it?
m-zeter Has anyone found a solution for Sofitech? Would it be possible to draw two lines? An upper l...
m-zeter Hm, i dont know exactly why, but I think, that the indicator needs lots of power. I need als...
Marcot18 Buonasera Maurinho, interessante l'indicatore che ha i proposto ma ancora di più interessant...
maurinho ciao marcot18 l'indicatore pubblico /proffessional lo puoi scaricare si chiama progo di will...
james effiong This strategy looks good
Nicolas Add it on price using the wrench on the left upper side of the price chart.
Stenozar thanks Nicolas, I' ll try again!
Radetzky Buongiono e grazie : l'immagine sopra ritrae l'indicatore sul TF 15 min ma a me funzio...
Steven Hi im looking for some help to put a automated code together BUY ORDER If EMA 10/25 is...
Juanjo Hola?. Exactamente cuál es su utilización?.
bolsatrilera Hola Juanjo, su principio esparecido a las bandas de Bollinguer.Las lineas de las bandas son...