Linear Regression Value - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources - MetaTrader 5 Resources



In the "good old days" programmers tried to optimize all the code they could. Optimization of linear regression calculations is one such example. A coder named "mathemat" (if I remember correctly, please correct me if I'm wrong) came up with a simplified formula for linear regression values: 3*lwma - 2*sma
Moreover, since both lwma and sma can be optimized into the so-called "loop-free mode", it was adopted as the best way to calculate it, and it produces the correct values. But this calculation lacks the intermediate values that a "normal" linear regression value calculation has:
So here is a different way of calculating linear regression (best: using the so-called "loop-free mode"), but with both intercept and slope

Attachment download
📎 linear_regression_value.mq5 (12.42 KB)
Source: MQL5 #50492
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •