Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

Metatrader 4 Indicators | Linear Regression Line | Source Code Included

RobotFX curates the best open-source MetaTrader code to inspire your trading automation.


Image for Linear Regression Line

The mathematical formula expressing the linear regression looks the following way:
у = а + bx, where:
у - close price;
х - position of the current time period in the database;
а - 1/п (Ey - bEх);
b - (nExy - EхEу)/nEх2 - (Ex)2;
п - the number of time periods during the summation;
E - the sum for n periods.

Experience adaptive trading with the Fluid Expert Advisor for MT4/MT5. Dynamic money management and trend detection. Click for info.

The method of least squares is used for linear regressions in order to fit the line in the data set. The best line is found by minimizing the distance from the data points to this line.

Thanks for reading. Discover premium MetaTrader solutions at RobotFX.

7325

Best MetaTrader Indicators + Profitable Expert Advisors