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, on the other hand, have used dividing the sum by N. In this case all the cross sums go away and the formulas are very compact.
Offset in relation to what? To the classical definition? Or to a normal distribution? In my opinion it makes no difference, neither with small N, nor with large N.
Is it only for the loyal participants of this topic or others (I mean myself) can join in ...(get a suit).
If interested, here is a linear regression indicator without cycles. Counts the regression from a large number of bars, in a fraction of a second.
And is it only for the dedicated members of this topic or others (I mean me) can join in ...(get a suit).
Thank you very much...It's really nice to have that attitude...Already got it and I'm studying it.
This may be justified. The estimate is biased, but if you don't work with very short LRs, the accuracy is adequate.
Offset in relation to what? To the classical definition? Or to a normal distribution? In my opinion it makes no difference, neither with small N, nor with large N.
P.S. But with respect to price charts this is irrelevant, which is why I agreed above that such a simplification is justified
If interested, here is a linear regression indicator without cycles. Counts the regression from a large number of bars, in a fraction of a second.
If you disable coloring, it counts 1.5 times faster. Accessing arrays takes a lot of time. And if you need a speed record type, you could use some other tricks. But I won't get a bonus for that.
By the way, I've looked briefly into MovingLR_2 code, and didn't see any interesting function to measure trend's speed - it's possible to build angle function in this case. In contrast, at_LR0 they are calculated on every bar. It means you can calculate RMS on every bar. And MovingLR_2 will not show pure linear regression, but something close to it. When it's just position of the end, it's not very important, but there are cases when you need exact linear regression.
LR(Bar i) = a*i + b
LR(Bar i-1) = a*(i-1) + b
From where
a = LR(Bar i) - LR(Bar i-1)
b = LR(Bar i) - a*i
Or did I do something wrong? Of course, a and b depend on i, as they should.
Or did I do something wrong?
Are you still awake...?
Or did I do something wrong? Of course, a and b depend on i, as they should.
Of course you did. You can't think of it that way. a and b are a function of the minimum squared deviation along the entire period. a is the angle of slope of the line along the whole period. And the increment in the LR end position, will not give the angle of the whole regression, but only the change in the b coefficient, which incidentally is the coordinate of the line end position.
If you disable colouring, it counts 1.5 times faster. It takes a long time to access the arrays.
And if you need speed record type of calculations, you could use some other tricks.
By the way, I've had a quick look at MovingLR_2 code and didn't see any calculations of a and b line coefficients,
...
And MovingLR_2 doesn't do pure linear regression. When you're just drawing the position of the end, it's not a big deal, but there are cases when you need a totally accurate linear regression.
A = (SumXY - N3*SumY)*N4;
B = (N1*SumY - SumXY)*N2;
For illustration, I attach MovingLR_2 version, which just draws current linear regression. Especially, because there was a mistake in previous one, when calculating N4 :)
MovingLR_2 gives pure linear regression and it's pretty easy to make sure of that. In at_LR0 there is inaccuracy of change from period in hours to period in bars. If we replace Close with (High+Low)/2 and take a period of 1 in at_LR0 and specify period not 60 but 61 in MovingLR_2 and apply it to the minute chart, the results will be absolutely coincident.
P.S. By the way, Mathemat, at_LR0 is a good example of how to calculate a zero bar in this kind of algorithm