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
Here is the indicator test.mq4
Here is the script that measures the calculation speed of the test algorithm
through iCustom() and through test() call.
P.S. In my example there is not so essential difference in number of operations for two variants - "serving code" works once, and loops are the same.
And why should you work with arrays in a built-in function? We are talking about the difference in the cost of calling a custom function embedded into the code and an external function called through iCustom().
1. The procedural programming style is second only to modular and object-oriented programming. So, putting the computation algorithm into a separate function is a logical step.
And why should you work with arrays in a built-in function? We are talking about the difference in the cost of calling a custom function embedded into the code and an external function called through iCustom().
2. similarly. It is the final efficiency I'm interested in. In case of MQL, it is usually the time needed for development plus the time needed for testing in the tester. Although, the extra seconds of waiting for the terminal to load the real account may also be very expensive. I mean nerves, not everyone has the right view on trading :)
And here are the results of the script.
As you can see, using a separate function is justified - the time difference for a billion passes cycle is only one second. But it is much easier to develop the code!
Here is more on how to find parameters of a linear regression. Taken from here - Linear Regression Channel
And here's a function that implements the algorithm described (maybe someone can use it):
The function is called like this:
There issomething wrong in the Danish kingdom.
I had to delete my previous post. There is an error in the algorithm.
I know a lot of people use this procedure but .... can't find the reason for the error HELP me.
Here is the script. The A and B coefficients are calculated twice.
The result is as follows
intercept = -3.33333333 slope = 5.00000000
intercept = -1102.16914108 slope = 0.00000091
And here is the same, but calculated in MathCad. In blue the results match, in red they don't (.
In Mathcad these are built-in functions, so most likely an error in MT4, but where ?
There issomething wrong in the Danish kingdom.
I had to delete my previous post. There is an error in the algorithm.
I know a lot of people use this procedure but .... can't find the reason for the error HELP me.
Here is the script. The A and B coefficients are calculated twice.
The result is as follows
intercept = -3.33333333 slope = 5.00000000
intercept = -1102.16914108 slope = 0.00000091
And here is the same, but calculated in MathCad. In blue the results match, in red they don't (.
This is a built-in function in Mathcad, so most likely an error in MT4, but where ?
Here is what Excel 2007 shows
So, it may be necessary to check Matcad.
One of the linear regression implementations, the degree of polynomial is 20, the number of calculation points and the offset of the starting point is set...
output is done using a channel depth is set in points... at a depth of 0 only the regression curve itself is output