![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I tried to simplify the code with this following, but it shows zero divide error. I know its because of the i = 0. But there is no other option too. I need Close[0] for current close price on the chart while calculating right. So without using zero on "i" how can I do it?
Thanks
You're not summing anything when you zero them inside the loop. You're not computing a slope/Intercept when you have only one point (inside the loop.)
Compare that to your original functions
You're not summing anything when you zero them inside the loop. You're not computing a slope/Intercept when you have only one point (inside the loop.)
Compare that to your original functions
Ok, then getting back to my original functions. I corrected it as you recommended earlier. But why graphs are like that. There is a huge variation from each data. I understand it must be something to do with the theory itself.
Well in the example below, For recent close price, x = 1 not zero, like I declared at first double sumx = 0; I tried declaring sumx = 1; but that's not helping.
This is the Excel calculation on EURUSD data, but on excel graphs are showing right.
I figure out what was the problem, i was calling function inside a function while calculating Intercept. But I solve the issue. Now its plotting right. But its plotting same way like the indicator I posted at the the first.
With Linear Regression Forecast indicator its still have such difference. :X