Tradingview's default linear regression indicator (the ta.linreg() function) uses least squares linear regression, which is similar but different than Deming regression. In least squares regression, the regression function minimizes the sum of the squared vertical distances between the data points and the fitted line. This method assumes that the errors or variability are only present in the y-values (dependent variable), and that the x-values (independent variable) are measured without error.

In time series data used in trading, Deming regression can be more accurate than least squares regression because the ratio of the variances of the x and y variables is large. X is the bar index, which is an incrementally-increasing function that has little variance, while Y is the price data, which has extremely high variance when compared to the bar index. In such situations, least squares regression can be heavily influenced by outliers or extreme points in the data, whereas Deming regression is more resistant to such influence.

Additionally, if your x-axis uses variable widths - such as renko blocks or other types of non-linear widths - Deming regression might be more effective than least-squares linear regression because it accounts for the variability in your x-values as well. Additionally, if you are creating a machine-learning model that uses linear regression to filter or extrapolate data, this regression method may be more accurate than least squares.

In contrast to least squares regression, Deming regression takes into account the variability or errors in both the x- and y-values. It minimizes the sum of the squared perpendicular distances between the data points and the fitted line, accounting for both the x- and y-variability. This makes Deming regression more robust in both variables than least squares regression.

Release Notes:

Updated name (had in title)

Premium strategies, indicators, and algorithms: www.patreon.com/wbburgin/membership

Use my strategies on CryptoRobotics: cryptorobotics.co/?trade=f23b09

Backtesting of certain algorithms (for fun): tinyurl.com/yc7jwj8h

Use my strategies on CryptoRobotics: cryptorobotics.co/?trade=f23b09

Backtesting of certain algorithms (for fun): tinyurl.com/yc7jwj8h