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
Please calculate the result of your negative value and correlate it with 32 bits of int, then read about arithmetic overflow and find your 17 days.
Welcome to the world of real programming.
I did not ask the question "where did 17 days come from? I'll repeat: I found a situation I did not understand in the tester, told it to me and received an explanation that (1) Sleep() function works with negative values too, and it produces a non-zero delay, (2) Sleep() function's work is emulated in the tester. If developers find it acceptable, what can I return? There's no need to calculate exactly 17 days.
What do you suggest? Terminate the programme in an emergency?
Yeah. We didn't see the elephant.
I have a strong suspicion about that line:
and in this case:
It seems to me the compiler shouldn't miss this. Do you have what? Not even a warning? If not, put in a request to Service Desk. Ok?
application#154746
How do we get the sequence number of the element with the maximum/minimum value in the s1.open array?
In this case it would be enough for me to have an instruction in "Sleep function" section ... (2) "Sleep() function is fully supported by the tester".
We have highlighted the basic questions about testing in a separate article, "Fundamentals of Testing in MetaTrader 5". Here we have tried to explain most of the nuances of using various functions in the tester. We have also explained the functions Sleep():
Sleep() function in the tester
The Sleep() function allows you to suspend for some time the execution of an mql5 program in an Expert Advisor or in a script, when working on a chart. This can be necessary when requesting some data, which at the moment of requesting are not ready and you need to wait until they are ready. A detailed example of Sleep() function use can be found in Data access organization section.
In the tester, calls of Sleep() don't delay the testing process. When calling Sleep(), the generated ticks are "played" within the specified delay, which can trigger pending orders, stops, etc. After Sleep() has been called, the time simulated in the tester is increased by the interval specified in the Sleep function parameter.
If, as a result of Sleep() execution the current time in the tester exceeds the end of the testing period, an error "infinite loop in Sleep" will be received. If such an error occurs, testing results are not discarded, all calculations are completed (number of trades, drawdown, etc.) and the results are passed to the terminal.
Function Sleep() won't work in OnDeinit() as after its call the testing time is guaranteed to be beyond the testing interval.
Figure 7. Scheme of using the Sleep() function in MetaTrader 5 terminal tester.
We have specifically covered the main issues of testing in our separate article, Fundamentals of Testing in MetaTrader 5. Here we have tried to explain most of the nuances of using various functions in the tester. We have also explained the Sleep() function:
I'm sorry, it's really my fault. I haven't tested it for 9 months and have missed the article.
It would be nice if mentioning of key articles in corresponding sections of the Reference Guide (I've already suggested something similar last year but today is a good chance to do it again). We all use F1 in the first place, after all.
You have several people here trying to point out your simple error with the arithmetic overflow.
That is, you didn't do what I asked.
You have several people here trying to point out your simple arithmetic overflow error.
==============================================================
You asked:
Would you be so kind as to calculate the result of your negative value, correlate it with 32 bits of int, then read about arithmetic overflow and find your 17 days...
I replied: Yes I didn't ask the question "where exactly 17 days came from?" :) etc.
Answering your current question. What you asked for - I did not do. Because it was done by me yesterday (I had slightly different initial data, but the essence of what I understood). Had someone compiled that script, I would have received as many as two warnings. Overflow/cutoff - I dealt with that myself yesterday.
The questions were why (1) function operates with negative values of the argument and (2) gives a delay in the tester for such arguments. Yet you again point to "programmer's error" with an overflow of int type. - I.e. you reject my test sample only because "overflowed value" was specified when selecting the Sleep() function argument. But the point is not in "overflowed value". It's just an additional touch to the test sample. It seems the participants of the discussion understood it. In the end, you can insert "not overflowing value" in the test example - all other things being equal, the essence of the question will remain the same (the question itself has already been dealt with).
Anyway, thanks for the tip. Because if the compiler hadn't warned you, your advice would have probably come in handy and made you think twice.
What are the limitations on its usage? W =(long)ChartGetInteger(Chart_ID[i],CHART_WIDTH_IN_PIXELS,0);
H =(long)ChartGetInteger(Chart_ID[i],CHART_HEIGHT_IN_PIXELS,0);
W_B =(long)ChartGetInteger(Chart_ID[i],CHART_WIDTH_IN_BARS,0);
Calling the function from void OnInit() all is correct, but from void OnTick() the data is incorrect in particular CHART_WIDTH_IN_BARS gives the number of bars visible, although I understand should give the number of bars fit to the chart without offset
Sorry for the primitive question.
The trade query is not running. Error 10014 - wrong volume in the request.
How can I understand/calculate from inside the EA what is the maximum and minimum lot volume I can buy at the moment?
The OrderCheck function is not suitable, because it only checks and does not say how many lots can be bought.
See ENUM_SYMBOL_INFO_DOUBLE enumeration and corresponding function. Is that what you mean?