Download MetaTrader 5

Professors, Professors, please help, so Confused on the code execution !!! - page 2

To add comments, please log in or register
Have you installed MetaTrader 5? Find out more about it!
Demos Stogios
Demos Stogios 2016.01.06 11:24  


Do you think the code below in "OnTimer()" costs over 20 ms to run?

It depends ; I mean, CPU goes up to 100% as you have said :) Of course i am joking; i may say that the strange part is that it even begins with 8%... In any case, i had a second thought about the situation, and obviously the issue is not due to processing time, as it starts to 8% . I am almost sure it is happening because of the automatic allocation of CPU power; as it is, opting for 100% looks like a bit aggressive, and it results to marginal perfomance of your software.

What I believe that it happens, is that, given the above, the code may take more than 20ms to complete ; even 21ms would result in a big difference after 100s of times of execution. The point is that you would get the wrong measurements if you rely at timeTick*20ms, instead of timeTick*21ms . Of course, the code would still need no more than 21ms to complete, so this may not be a critical issue after all... A solution , if needed, could be to contact Amazon and see if they can top out the instance at something like 95%, which probably will leave some room for the code to execute properly

best regards 

To add comments, please log in or register