Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Guys, simple question: in the following code, is the independent variable some sort of sequence of integers (EG if the length is 20, that the independent variable is 1-20), or is it the lagged price?
Value1 = RSquare(BarNumber,PriceH,Length);
If LinearRegSlope(PriceH, Length)<0 Then Value1 = -Value1;
The indicator I'm looking at is called R-squared autocorrelation, but I'm not overly familiar with tradeStation.
Thanks a lot.
Can you help answer these questions from other members on NexusFi?
I suppose I'm asking what both of those lines do. That is, am I doing a rolling linear regression on integer values specifying time, or am I doing the rolling linear regression on the price against a lagged version of itself?
I am not too good at math so I will stick to the first part of your question .
The first line calls a function called RSquare which takes 3 inputs, judging by the naming convention lets call them the independent input, the dependent input and length input.
The independent input, BarNumber, is a sequence of integers. For a given bar, it returns the sum of the bars in the chart before and including the given bar. If a length of 20 is specified and there are 500 bars in the chart, then the RSquare function will use the previous 20 values for this variable, i.e, 481-500.
The dependent variable seems to be an input and judging by its name, PriceH, it seems to be using the high of bars. You can verify this by the inputs to the study.
The returned value is held in a placeholder called "Value1".
The second line calculates the slope of the "PriceH" series using the same "Length" and changes the sign of the value returned in line 1 if the slope is negative.
Right. I'm asking about that slope that's positive or negative. Is that also using those same integers (EG 481-500) as the independent variable in that second line as well?
Doesnt look like x begins at 1. x begins at BarNumber - length where BarNumber = the current number of bars in the chart so x should begin at 481 if the current bar being calculated was bar # 500 in the chart. If length was 20, x would be 481 through 500.
Alright, so Rsquare is the R-squared of the high of prices (y) with respect to bar number (x).
The slope, ALSO, is the high of prices (y) with respect to bar number(x)?