I am trying to call properties of a Linear Regression channel. I have tried created an indicator that creates a LinearRegression object, and then reads from it, such as below:
I am doing this because I want to know the absolute difference between the end point of the linear regression line and the start point. When I draw and object via script, I am able to call those properties above. However, when I try to create an indicator that makes an oscillator of this information, nothing seems to work.
My proposed work around is to simply calculate the actual linear regression line myself (was trying to bypass this by creating the Lin Reg channel and reading data from it) and then read the two data points I am looking for.
The only problem is I just don't understand how to create/calculate the said Linear Regression line.
If there is any assistance that can be lent here, that would be awesome. I suppose my direct ask is:
What would be the formula for the LinReg, and how then would I extract the price levels of the terminal points of this information so I can create an oscillator of the difference.
MQL4:
Iterates through code: { Create OBJ_Regression; price1 = ObjectGet(name of obj, OBPROP_PRICE1); price2 = ObjectGet(name of obj, OBPROP_PRICE2); ObjectDelete(regression) }
I am doing this because I want to know the absolute difference between the end point of the linear regression line and the start point. When I draw and object via script, I am able to call those properties above. However, when I try to create an indicator that makes an oscillator of this information, nothing seems to work.
My proposed work around is to simply calculate the actual linear regression line myself (was trying to bypass this by creating the Lin Reg channel and reading data from it) and then read the two data points I am looking for.
The only problem is I just don't understand how to create/calculate the said Linear Regression line.
If there is any assistance that can be lent here, that would be awesome. I suppose my direct ask is:
What would be the formula for the LinReg, and how then would I extract the price levels of the terminal points of this information so I can create an oscillator of the difference.
Last edited by a moderator: