yes to everyone, it doesn't fit the question-answer format and it's stupid formatting, you can't insert a line of code into the text without taking it to the next line, you can't quote a piece of code properly: the whole message is pasted out of pocket.
No, it's OK. If there are no positions, then i=OrdersTotal()-1 will be equal to -1. And the loop condition i>=0 will not be executed immediately. And the program will not enter the loop.
Aleksei Stepanenko #: is greater than or equal to, because the first element of the array also needs to be taken into account, and its index in the array is zero.
Oh, right, thanks. But it's a crutch, of course. Just like the entire mql, of course.
This is the website of the developers of the platform and the MQL language.
Where else would you get the most accurate answers?
Your question represents a lack of understanding of how to work with arrays.
OrdersTotal, at 1 order returns 1 and not 0. When there are 0 orders, it returns 0.
"This is a website of the developers of the platform and MQL language. Where else would you get the most accurate answers? "
- Just because it's a developer's resource doesn't mean it's the right place to do it, as there are resources specifically designed for the question-answer format.
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.
What's wrong with this one?
yes to everyone, it doesn't fit the question-answer format and it's stupid formatting, you can't insert a line of code into the text without taking it to the next line, you can't quote a piece of code properly: the whole message is pasted out of pocket.
From one, OrdersTotal will return zero when there are no orders. But for some reason.
for ( int i = OrdersTotal() ; i > 0 ; i -- )
gives an infinite loop, and so >= not.
Is there another more convenient platform for communicating about mql?This is the website of the developers of the platform and MQL language.
Where else would you get the most accurate answers?
And your question is from the area of misunderstanding how to work with arrays.
the loop is not set correctly:
it should be like this:
From one, OrdersTotal will return zero when there are no orders. But for some reason.
for ( int i = OrdersTotal() ; i > 0 ; i -- )
gives an infinite loop and so >= not.
s.w. is there another more convenient platform for mql communication?is greater than or equal to, because the first element of the array also needs to be taken into account, and its index in the array is zero.
Hello!
Variables are declared as follows
input string startHour ="00:20"; input string endHour ="23:40"; datetime startTime, endTime;In the mql4 code, the line is like this
The mql5 compiler gives the error'(TimeToString' - variable expected),warning(implicit conversion from 'number' to 'string')
Could you please tell me how to correct it?
...
Can you please tell me how to fix it?
Do not duplicate code (principle DRY = Don't Repeat Yourself) Use functions. For example:
Any invalid string is converted to zero time
This is the website of the developers of the platform and the MQL language.
Where else would you get the most accurate answers?
Your question represents a lack of understanding of how to work with arrays.
OrdersTotal, at 1 order returns 1 and not 0. When there are 0 orders, it returns 0.
"This is a website of the developers of the platform and MQL language. Where else would you get the most accurate answers? "
- Just because it's a developer's resource doesn't mean it's the right place to do it, as there are resources specifically designed for the question-answer format.