Code for basic Linnear Regression Line

Forums ProRealTime English forum ProBuilder support Code for basic Linnear Regression Line

Viewing 11 posts - 1 through 11 (of 11 total)
  • #47181

    Hi!

     

    Does anyone have the basic default code for creating the Linnear Regression Line the way its drawn by default in PRT? Also if one knows the containing codes for the RAFF and Standard Error lines that are drawn by PRT Defaults.

    I have managed to get the second point x and y axis as it is the last bar of (n) periods linnear regression – but i dont know how to find the first x and y axis.

    I am aware of this indicator: https://www.prorealcode.com/prorealtime-indicators/triple-raff-channel-projection-on-price/ but it does not contain the specific code i am looking for and does not help with my idea.

    So if anyone knows the code for the linnear regression line it would be greatly appreciated!

     

    //Viktor

    #47196

    You can find everything needed and a full example on how to draw a line from linear regression coordinates, in this indicator: https://www.prorealcode.com/prorealtime-indicators/regression-channel-sketcher/

     

    #47212

    I have read that one but several times but still dont get it.

    Is

    the basics for finding coordinates? In this case high. Is it always 1.5 times the standard deviation of (n)?

    Also it does not explain calculation for Raff and Standard error.

     

    As you can guess i lack some mathematical skillz, but learn quick so im just trying to understand the logic.

     

    Thanks for your patience and understanding.

    #47222

    I have now once again used the specific code you forwarded (but using (close) and only 1 line) – and it does not translate into the same result as just drawing a Linnear Regression Line over said period.

    Im really confused

    #47290

    Another example:

    In the attached screenshot, you have the automatic trendline plotted by the platform (violet one) and the one from the code (the black one). Because I took the Close for the linearregression indicator, there is a little difference with the two points I chose to draw the linear regression line, but that’s how it goes.

    #47296

    Thank you for your answer!

    However, it still does not translate to a correctly drawn linear regression line like the one drawn by default. Please see attached picture. Maybe i am doing something wrong?

    Red Line = Default Linear Regression Line, 62 bars

    White = Line from this code:

    As you can see its way off. If i just want to make a line exactly like the one the program draws for me – what should i write?

    Would greatly appreciate a solution!

     

    Thanks!

    Viktor

     

    Edit: The X1 axis is correct but the Y1 (in this case z1[p]) give the wrong coordinate

    #47717

    Is there no one that has the code to copy the linear regression line drawn by PRT?

    #49014

    I am still looking for the answer to this. If anyone knows it would be appreciated.

    #59229

    BUMP would be fantastic to have access to the source code for PRT builtin indicators

    #59242

    PRT software is proprietary much like Windows or MacOS and it is (and is likely not to ever be) open to the public.

    #59304

    I hardly want the software operating system , just the way an indicator coded . Such as linear regression  .  I dont think its a huge ask

    1 user thanked author for this post.
    avatar Bel
Viewing 11 posts - 1 through 11 (of 11 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login