Yogurtu
Yogurtu

Reputation: 3041

What's the logic within LINREG function in pine (trading view)?

So i'm building some sort of charts in C#, i'm basically reverse-engineering what I need from TradingView functions which uses PineScript.

I'm Kind of stuck with this one "LINREG" because there is no deep explanation on what's being calculated whitin the function: https://www.tradingview.com/pine-script-reference/v1/#fun_linreg

interface: linreg(source, length, offset) → series

formula: linreg = intercept + slope * (length - 1 - offset)

Does somebody has the logic behind this 3rd bullet?, not necessary in C# code, to understand the logic will be enought for me.

Thanks in advance.

Upvotes: 2

Views: 5648

Answers (2)

Alex Fx
Alex Fx

Reputation: 61

LINREG short for linear regression, a statistical tool you may know about already.

This website will help you with understanding the formula-

https://budgeting.thenest.com/calculate-linear-regression-lines-slopes-stock-prices-33550.html

Upvotes: 2

Starr Lucky
Starr Lucky

Reputation: 1961

x argument is the source series.

There is modern reference man: https://www.tradingview.com/pine-script-reference/v5/#fun_ta{dot}linreg

Upvotes: -2

Related Questions