Quadratic regression

Quadratic regression

A quadratic regression is the process of finding the equation of the parabola that best fits a set of data. Period of the study can be modified with the “length” setting (default=100).

Converted from a tradingview code.


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. murri • 08/22/2018 #

    Muy interesante. Solo que a mi me aparece no sobre el precio sino en pantalla aparte. ¿Cómo hacerlo para que se sobre imprese con la pantalla del precio? Gracias

    • Nicolas • 08/22/2018 #

      Agréguelo a la tabla de precios usando el botón de configuración de precios en la tabla.

  2. Traderfox06 • 08/22/2018 #

    Dear Nicolas,

    I believe in the high potential of quadratic regression for an automated system.
    Therefore, I would like to understand in detail the principles how you have coded the algo.

    All the mathematical derivations I found, look somehow different, e.g. this one:
    Could you give me some more detailed information, please?

    Another question:
    Does this summation command:
    S11 = summation[length](x2) – square(summation[length](x1))/length,
    mean, that this line is like a loop which is processed times every 5 minutes if the period is M5?

    Thanks and kind regards,


    • Nicolas • 08/22/2018 #

      S11 variable is not a loop but a ratio calculation. In real time the codes is processed on each new tick received. On history, it is calculated with the Close of each candlestick, same goes for all indicators, not only with this one.

  3. Stephan_V • 08/22/2018 #


    This regression delivers damn good results, especially for trends !

    I’m wondering what degree of Polynomial Regression is used, and frankly, I can’t recognize any polynomial resolution from your code.
    Do you have any background and formula that helped you in building that piece ?


    Et toutes mes félicitations pour ce site que tu gères de main de maître ! Ca doit représenter du temps et bcp d’expertise …
    Saches que ça aide beaucoup de monde, à commencer par moi-même.


    • Nicolas • 08/22/2018 #

      Least square method is used here in order to get the perfect y = ax2 + bx + c

Register or


avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
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. ...
FernetTrader think i found a solution!
monochrome Thanks for the indicator. Very interesting!
monochrome Can you please share how you made it work? I cant seem to make it work in a strategy
DIOS Bonjour Nicolas, comment coder un indicateur de rsi de Divergence? Merci pour ta réponse
Nicolas En apprenant la programmation :) Plus sérieusement, il y a quantité d'exemples dans la libra...
DonTony Bonjour Nicolas, Très bel indicateur! Bravo!
redactv7 On my charts, the indicator doesnt go on the upper pannel, on prices, but under like an osci...
Nicolas apply in on the chart, look at this how-to video: https://www.prorealcode.com/blog/video-tut...
jonpt88 interesting code thanks!
Jack86gv Ciao Nicolas, e possibile fare uno screener con questo codice ovvero vorrei sapere quando il...
Nicolas https://www.prorealcode.com/topic/screener-regressione-canale/
wharfdog Hi Nicolas, Fantastic work, I'm really grateful for this. I was wondering if it would be ...
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...
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
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
KarlBenjamin This "indicator" alone has completely changed my algorithms for the better! Id even go as fa...
coyP Big thanks ! Can you explain me how can I put this ON my graph and not under the graph please ?
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.
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 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...
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...