Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

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

author EAcpu | 3 reads | 0 comments |

Linear Regression Value - indicator for MetaTrader 5

Linear Regression Value - indicator for MetaTrader 5

Linear Regression Value - indicator for MetaTrader 5

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

Linear Regression Value - indicator for MetaTrader 5

Linear Regression Value - indicator for MetaTrader 5


Attachment download

📎 linear_regression_value.mq5 (12.42 KB)

Source: MQL5 #50492

Verification code Refresh