joo: Maybe the mere presence of Sleep (compared to its absence) in the code somehow affects the overall execution time, but the fact that Sleep does not count in the tester - that's for sure.
Well, I'm not an expert here... Half a minute delay in processing Sleep() function with a negative argument and loss of 17 testing days - those are the facts.
That is, there is no error of the tester or the MQL5 execution environment, but there is a clear error of the programmer.
It's quite clear.
Renat:
Sleep is emulated in the tester completely and quite accurately.
Due to the arithmetic overflow when working with integer values the wait time is 17.5 days. That's exactly how long the tester waited.
Hmm, there you go. And I mistakenly thought Sleep was just ignored.
So, for example, if I set Sleep (3 months) in Expert Advisor in testing mode, the tester would simply fast-forward the history for 3 months? - That's great.
Yes, it will rewind. Only the limit of the function is 49 days, until the millisecond counter is full.
During the waiting period the tester continues to fully emulate the trading environment, including all processing of previously placed orders. The tester in MT5 is very detailed.
I tried it with another symbol but it did not show up in the comment -1
REMARK: Freeze after a few sec. I will run the code from int OnInit()
Yes. We didn't even notice the elephant.
Something makes me very suspicious about this line:
Comment(ArrayMaximum(s1,0,WHOLE_ARRAY));
ArrayMaximum
searches for the maximum item in a one-dimensional numeric array.
intArrayMaximum( doublearray[],// array to search intstart=0//from which index we start the search intcount=WHOLE_ARRAY,// number of indexes to be checked );
and in our case:
MqlRates s1[];
I think the compiler shouldn't skip this. What do you have? Not even a warning? If not, put in a request to Service Desk. Okay?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Maybe the mere presence of Sleep (compared to its absence) in the code somehow affects the overall execution time, but the fact that Sleep does not count in the tester - that's for sure.
The code hangs up the terminal:
What is the reason?
The code hangs up the terminal:
What is the reason?
Is the terminal not set to Unlim?
For starters:
Isn't Unlim in the terminal settings?
the max bars are 5000. can this value be reduced?
I don't think you can do less (I'm not sure).
What does Print(count) show?
I don't think less is possible (not sure).
Well, what does Print(count) return?
in comment -1
I tried it with another symbol but it did not show up in the comment -1
REMARK: Freeze after a few sec. I start the code from int OnInit()
Yes, and it works in the tester, because Sleep is ignored in the tester.
Sleep is fully and accurately emulated in the Sleep tester.
In the example, due to arithmetic overflow when dealing with integer values, there was just a 17.5 day wait. The tester waited exactly that long.
Therefore, there is no error in the tester or in the MQL5 execution environment, but there is an obvious error made by the programmer.
Renat:
That is, there is no error of the tester or the MQL5 execution environment, but there is a clear error of the programmer.
It's quite clear.
Renat:
Sleep is emulated in the tester completely and quite accurately.
Due to the arithmetic overflow when working with integer values the wait time is 17.5 days. That's exactly how long the tester waited.
Hmm, there you go. And I mistakenly thought Sleep was just ignored.
So, for example, if I set Sleep (3 months) in Expert Advisor in testing mode, the tester would simply fast-forward the history for 3 months? - That's great.
During the waiting period the tester continues to fully emulate the trading environment, including all processing of previously placed orders. The tester in MT5 is very detailed.
in comment -1
I tried it with another symbol but it did not show up in the comment -1
REMARK: Freeze after a few sec. I will run the code from int OnInit()
Yes. We didn't even notice the elephant.
Something makes me very suspicious about this line:
ArrayMaximum
searches for the maximum item in a one-dimensional numeric array.
intArrayMaximum(
doublearray[],// array to search
intstart=0//from which index we start the search
intcount=WHOLE_ARRAY,// number of indexes to be checked
);
and in our case:
MqlRates s1[];I think the compiler shouldn't skip this. What do you have? Not even a warning? If not, put in a request to Service Desk. Okay?