Understanding Linear Regression Value for MetaTrader 5: A Trader's Guide

Mike 2024.06.26 06:02 22 0 0
Attachments

Back in the day, traders and coders were on a mission to squeeze every drop of efficiency out of their code. One standout example of this is the optimization of the linear regression calculation. A coder known as 'mathemat' (please correct me if I'm mistaken!) developed a simplified formula for calculating the linear regression value: 3 * LWMA - 2 * SMA.

Both the LWMA (Linear Weighted Moving Average) and SMA (Simple Moving Average) can be optimized into what we call 'loop-less mode.' This approach has been widely adopted as it yields accurate results. However, this method does miss out on some key intermediate values that the traditional linear regression calculation provides:

  • Linear Regression Intercept
  • Slope of the Linear Regression Line

So, while we've got a different way to calculate linear regression that is optimal (thanks to that 'loop-less mode'), it’s important to note that it also includes both the intercept and slope.


List
Comments 0