Linear Regression Calc

jknowles

New member
Joined
Aug 25, 2021
Posts
3
Likes
1
I am trying to calculate the Linear Regression curve for a custom indicator. Looking through the code for the available indicators I found the LinearRegCurve file that shows how to calculate this.

double linReg=Utility.linRegLine(series, index, period, input, period)[0]; // end point of line

which uses the following import
import com.motivewave.platform.study.general.Utility;

However I do not have access to that import or more importantly the method call. How can I get access to this method call?
 
I am trying to calculate the Linear Regression curve for a custom indicator. Looking through the code for the available indicators I found the LinearRegCurve file that shows how to calculate this.

double linReg=Utility.linRegLine(series, index, period, input, period)[0]; // end point of line

which uses the following import
import com.motivewave.platform.study.general.Utility;

However I do not have access to that import or more importantly the method call. How can I get access to this method call?
This is probably not exactly the answer you're looking for, but perhaps it may be something that can be of more use than just this one case. After having been down a similar road, I discovered https://github.com/kevin-wayne/algs4 (see https://github.com/kevin-wayne/algs.../edu/princeton/cs/algs4/LinearRegression.java). It has helped me quite a lot; It is licensed under GPL so might want to check that if its for a commercial application.
 
I used Linear Regression in one of my indicators. There is a built in function in Util.leastSquares() which can help you calculate the linear regression curve. Please check this entry in the docs.


I had a list of closing prices which I had to fit into an array of Points2D objects in order to be passed into this function.
 
Top