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?

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

  1. volpiemanuele • 04/13/2016 #

    Tanks,
    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 :
      http://www.prorealcode.com/blog/video-tutorials/add-and-configure-indicators-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 http://www.prorealtime.com

  3. Gustaf • 04/13/2016 #

    Thank you Nicolas.Now it works!

  4. HANTZ • 04/13/2016 #

    Hello,
    with
    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!

    BR,

    Renaud

  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 : https://www.prorealcode.com/prorealtime-indicators/linear-regression-slope-oscillator/

  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
    Else
    Len = 100
    EndIf

  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: https://www.prorealcode.com/prorealtime-indicators/standard-deviation-standard-error-linear-regression-channel/
      This new one is the same as the default tool of the platform.

  9. Aragorna • 04/13/2016 #

    Hello, Is it possible to updated the indicator to the more updated versione of ProrealTime? it does not plot the upper and lower channel ine, but only the centre. thank’s in advance

    • Nicolas • 04/13/2016 #

      Use that code instead: https://www.prorealcode.com/prorealtime-indicators/standard-deviation-standard-error-linear-regression-channel/

avatar
Register or

Likes

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

+1 more likes

Related users ' posts
TempusFugit Masala, thanks for your contribution. I don´t like the offmarket spreads neither ;) I unders...
Uveus Tempus, me da un error al validar el codigo, sobre la variable N. Al crear el indicador me ...
TempusFugit Hi Uveus, I am guessing you inserted the code of the indicator into the system code, is ...
finplus bonjour, il y a un problème à la fin du code avec elsif (close 0 then ... ne manque t il pas...
kj1988 Hello Nicolas, thank you for this useful indicator. Could you tell me how I can remove the...
Nicolas remove lines 101 to 103
KarlBenjamin This "indicator" alone has completely changed my algorithms for the better! Id even go as fa...
ashee CAN YOU SHARE MT4 FILE
coyP Big thanks ! Can you explain me how can I put this ON my graph and not under the graph please ?
diegofe_2000 cordial saludo NICOLAS , gracias por excelente indicador. ¿ es posible obtenerlo en MT4 ? ...
Nicolas Lo siento, pero no estoy trabajando para ayudar a la gente aquí de forma gratuita para promo...
diegofe_2000 Nicolas , gracias por tu atención. La pregunta era por curiosidad (yo no trabajo ni manejo ...
reb Hello Marc your strat seems very intersting, will take a look Reb
897148 What exactly is meant by Total price? Is r1 =28 in your example the no of days for "Total P...
Maxime Baudin Nice, thanks!
rowestock Hi Nicolas, I am revisiting this indicator and wanted to ask, is it possible to replace sty...
Nicolas Why not, please add a new request in our probuilder forums.
albertocampagna Sei grande Nicolas :-)
SAcht Dear Nicolas, Great work, thank you very much!I would love to use the indicator in ProScree...
SAcht btw: The above-posted ProScreener is supposed to show stocks for which the center line has i...
xel @DerPat - I don't see any question regarding the indicator.  Anyway, I think I give enough l...
diegofe_2000 Xel, tu eres el creador de este indicador? Bueno te  cuento que es muy bueno para hacer est...
xel Buen día @diegofe_2000 -  Claro, mandalo y por aquí lo probamos en otros instrumentos y si g...
mamio Very nice indicator. Why doesn't it refresh as time passes?
Nicolas It should refresh on each bar.
mamio On my PC it doesn't refresh. I am using intraday tick bars (not minutes). Unfortunately I do...
Nicolas You can try this code for buy and hold curve line: capital = 10000 mylot = 2 i1 = capi...
soukenson Bonjour Nicolas, Je ne comprends pas où ajouter le code que tu as a donné dans le code initi...
Nicolas Tu veux parler du code pour comparer avec le "buy and hold" ? Si oui, tu as tout ce qu'il fa...
Nicolas
8 years ago
dave
8 years ago
Wolf Just for information: This calculate code is interesting, but it is not a Triangular Moving...
Dron Hola Lobo, soy nuevo en programación, pero me interesa ese indicador, en tu mensaje estas ha...
supertiti // TMA CENTER Channel by Dave modifié // parameters // HalfLength = 50 // AtrLength = 10...
211 Really nice indicator Nicolas! Well done!
supertiti Bonjour Nicolas comme j'avais l'impression qu'il en manque un bout j'ai fais ça : Peux...
Nicolas Merci supertiti ! C'est juste, encore un ptit bug quelquepart ! :|
Vicari0us Really liking this indicator. Thanks
SB-FO Moving your last response to this post. Thanks for conforming the code below. How does PRT/...
Nicolas It is obtained by substracting the x days before Close from today’s Close. X is the paramete...

Top