Linear Regression Statistics

Linear Regression Statistics

Regression channel: this ProRealTime script is designed to generate a linear regression channel and perform several analytical determinations based on this regression.

Here’s a complete analysis and explanation of the code:

  1. **Parameter definition** : The script begins by defining the parameters of the regression channel, such as channel type, deviation multiplier and drawing colors.
  2. **Regression calculations**: it uses a “for” loop to calculate the sums of price (sumy), time (sumx) and their respective products and squares needed to compute the slope (b ) and y-intercept (a) of the linear regression line.
  3. **Draw the regression line**: Once “a” and “b” have been determined, a segment is drawn to represent the regression line.
  4. **Calculate channel width** : The channel width is determined by the standard deviation or standard error multiplied by a deviation factor “NbDeviation”.
  5. **Draw channel**: The script draws the upper and lower limits of the channel, as well as the median line. Green triangles suggest bullish zones and red bearish zones, indicating buy and sell zones.

 

 

 

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

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Nicolas I would not recommend using this version of the linear regression channel, but this one inst...
Aragorna Hello, Is it possible to updated the indicator to the more updated versione of ProrealTime? ...
Nicolas Use that code instead: https://www.prorealcode.com/prorealtime-indicators/standard-deviation...
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
9 years ago
dave
9 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