Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1685
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
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.