Errors, bugs, questions - page 2879
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've reworked it a bit
(it's better not to use a macro that way ;)
I've reworked it a bit
(so it's better not to use macro ;)
When testing, I confuse the code as much as possible to prevent the optimizer from throwing out empty loops
you have
// for(int i = 0; i < 5; i++) sum += u.param[i];
Optimization of MQL execution may terminate the first loop beforehand, since the calculated values are not used, so something should be done after the SpeedTest() with the results - this loop
i checked it with the commented loop, i didn't throw it away, but in the other test i may crash
macro is a matter of taste, i have tested it many times and it works, i don't see the point of writing the same thing by hand
UPD: found where I read how modern compilers work now, pretty informative
https://habr.com/ru/post/431688/
https://habr.com/ru/post/47878/
the code gives the iRSI value of handles and tp is always only 10, but prices and graphs change, too.
iRSI(_Symbol,PERIOD_H1,14,PRICE_CLOSE)
build 2652
the code gives the iRSI value of handles and tps always only 10, but the prices and the chart change, too.
iRSI(_Symbol,PERIOD_H1,14,PRICE_CLOSE)
build 2652
You have got the indicator handle, it is 10
Next, you need to get the values on the right bar
Read the help, or search for answers on the forum - they are many
You have got the indicator handle, it is 10
Next, you need to get the values on the right bar
Read the help, or search for answers on the forum - there are many of them
Got it. I will study the buffers. It's strange, I had a feeling that everything should work as it is, maybe I confused it with mql4.
The strange thing is that I googled it and could not find it in mql5 to get indicator's data.
Aha, according to your example as I understood the value of indicator RSI is in the end in a variable of the following form
checked:
2020.10.15 21:48:01.401 SpeedTst (EURUSD,H1) tst 1 : : loops=10000000000 ms=10864370
2020.10.15 21:48:12.264 SpeedTst (EURUSD,H1) tst 2 : : loops=10000000000 ms=10862287
the difference is not significant, it is highly probable that if we switch the tests in the opposite order, the results will be the opposite
not critical
it is hardly right to include rand() in the test since this function consumes much more resources than other commands.
I think this would be a more correct test:
Result:
Fortunately, I've put it on the wrong horse after all. The unions are a bit faster. They are more convenient to work with and the code is more readable.
it is hardly correct to include rand() in the test, as this function is an order of magnitude more resource-intensive than the other commands.
not critical at all
rand() execution time is constant, most likely it is a common C++ function, google "rand c++ source code"
you must initialize it, but if you initialize it with constants you may encounter optimization
in general, i don't understand the dislike of rand()
an option is to initialize with something like this:
would be fast.
ran your script, imho not correct.
The main time is loading code into the cache and then into the processor
and add the discreteness of the system timer
we get... almost a random number.
you need to test it for a long time, about 100500 times, imho
It is unlikely to be correct to include rand() in the test, as this function consumes an order of magnitude more resources than the other commands.
I think this would be a more correct test:
Result:
Fortunately, I've bet on the wrong horse after all. The unions are a bit faster. They are more convenient to work with, and the code is more readable.
Once for once, and at a distance of the first win, (like the first method has removed the conversion line from short to something)
not critical at all
rand() execution time is constant, most likely it is a common C++ function, google "rand c++ source code"
you must initialize it, but if you initialize it with constants you may encounter optimization
in general, I don't understand the dislike of rand()
as a variant to initialize with something like this:
will be fastThe point was that you should measure exactly what you need to measure, without any extraneous stuff.
The point was to measure exactly what is required, with no extras
no
If there are repeated code fragments, you will get optimization testing!
What difference does it make how long rand() is executed?
let it be executed 2/3 of the test time, the main thing is that the rand() time should be constant
Your MQL code will use system MQL-functions, right? - what's the point of testing a perfect code?