
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 won't argue about LR. SO WHERE IS THE ERROR IN THE INDICATOR CODE???????
how LR is calculated
//Indicator is calculated using the formula:LR = at+b
//where LR - forecasted "average" closing price,
//t - point in time,(n1 variable in the indicator)Pt - closing price of the last n periods.(Close[n2])
//a = (n*SUMM(t*Pt) -SUMM(t)*SUMM(Pt))/(n*SUMM(t^2) - (SUMM(t))^2) - angle tangent of the regression line,
//b = 1/n*(SUMM(Pt) - a*SUMM(t)), - horizontal shift}
indicator code above.
It calculates from n=1 to 100 incorrectly, then outputs n=22 and the result is correct, I think the loop is written incorrectly, but I don't know where.
It seems to be unsynchronised. For bar n x takes nn, with the index for y being
.And in general
there are a lot of regression indicators nearby, e.g.
https://forum.mql4.com/ru/10446/page39, if you're looking for all of them.
it's better to start at the end.
n1 is not equal to nn but varies from 1 to nn - the period of the indicator.
and n - number of bars to be recalculated (to work faster and without pulling the whole tail)
In general https://forum.mql4.com/ru/10446/page39 is not a linear regression but rather a derivative of the MA.
It seems to be unsynchronised. For bar n x takes nn, with the index for y being
and n is the number of bars to be recalculated (to work faster and not to drag the whole tail)
In general https://forum.mql4.com/ru/10446/page39 is not a linear regression but rather a derivative of the MA.
And if the shift is not needed, replace with
to After this, compare what is drawn by this indicator with the one by at_LR0. mq4 and try to find out why it is not a derivative of the MA and how to correctly get rid of the tail.
P.S. Not to bother with the parameters, let the indicators be placed on the hour chart and set the period of your indicator to one more.
THANK YOU so much for the tip. I would not have guessed, it's too bad it's not written in the language manual.
It turns out that wherever one of the variables is an integer, the constant must be written as a fractional number. I'll keep that in mind.
And as for DR or not, it's a private matter.
Put my indicator on the chart and pay attention to the inflection points of the line. It is always the end of the trend and not a bad exit point.
And its intersection with the MA (any) is also nice.
I would be very thankful to receive information about how to make the indicator faster, how to increase MT speed.
And may be someone knows where is the information about the speed of execution of various MT operators (for example, how many clock cycles are executed in different operators of the loop.).
(the main mistake was here).
THANK YOU so much for the tip. I would not have guessed, it's too bad it's not written in the language manual.
It turns out that wherever one of the variables is an integer, the constant must be written as a fractional number. Got it.
Also, I would be very grateful for any information on how to make the turntable faster, how to increase MT speed.
And if anyone knows if there is any information about execution speed of different MT statements (e.g. how many clock cycles different statements are executed).