Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Thank you!
To be honest, you are using so many wrong data-types and doing unnecessary type conversions that I really don't know where to begin.
For example, why are you using a "int" data-type if you plan to return a "datetime" data-type from your function?
int GetHistoryCloseTime() { ... }; // why an "int"?
Use a "datetime" instead, if you are plan to return a date and time ...
datetime GetHistoryCloseTime() { ... }; // use a "datetime" if you are going to return a date and time
Same goes for the variable that will hold the deal's time ...
datetime DealTime;
And why convert it to string to then convert it back into a "datetime"? It's totally unnecessary and the reason for the warning!
ClosingTime=TimeToString(DealTime,TIME_DATE|TIME_MINUTES);
Also, there is nothing in your code that gets the deal's time or a position's closing time.
get a warning "implicit conversion from 'string' to 'string'"
Try replacing Symbol() with a variable of the string type in:
if(OrderGetString(ORDER_SYMBOL)==Symbol())
That's the only double "stringy" thingy that I can see, and they're both functions.
int GetHistoryCloseTime()
string GetHistoryCloseTime()
To be honest, you are using so many wrong data-types and doing unnecessary type conversions that I really don't know where to begin.
For example, why are you using a "int" data-type if you plan to return a "datetime" data-type from your function?
Use a "datetime" instead, if you are plan to return a date and time ...
Same goes for the variable that will hold the deal's time ...
And why convert it to string to then convert it back into a "datetime"? It's totally unnecessary and the reason for the warning!
Also, there is nothing in your code that gets the deal's time or a position's closing time.
Thanks Fernando, not your fault, its my ignorance...
May i request where is can find "positions closing time"? you mentioned, in documentation
and yes I'm familiar with C/Cobol/Pascal/Fortran/Assembler not with C++ Scripting like MQL5
and yes Migrating from MQL4 to MQL5 is a good basic start doc (https://www.mql5.com/en/articles/81) , but lacks on advanced informations, AFTER 14 years of release....(no information about MQL4:OrderCloseTime->MQL5 in this doc)
So, frustration level is very high, therfor i postboned migration of perfect working MT4 EA since several years....
Once again, not your fault! I'll keep trying searching for reasonable documentation or code examples for 14 additional days, if i cant find some, i'll postboned migration for 2 years again...and again....because lack of reliable information/documentation ist not my or your fault but fault of MetaQuotes Ltd.
Kind regards

- www.mql5.com
Try replacing Symbol() with a variable of the string type in:
That's the only double "stringy" thingy that I can see, and they're both functions.
If you are transitioning from MT4 to MT5, you will find that the trading mechanism is completely different.
So, I suggest you start by first learning how to understand the MT5 trading mechanisms and how to use the MQL5 trade functions ...
Orders, Positions and Deals in MetaTrader 5
MetaQuotes, 2011.02.01 16:13
Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
I also highly suggest you study the MQL5 programming for traders - Book on MQL5.com too.

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
get a warning "implicit conversion from 'string' to 'string'"
string to number Ok
number to string OK
but "string to string" is complete new, i have no idea where is should start...
The idea ist to count how many orders on (Symbol) D1 are executed & closed (regadeless of profit)
Then i can compare it like
Then i can stop open new orders, if d1count > maxd1trades for example
Maybe i'm complete wrong ( i'm sure :) )
The Original MQL4 code, which works perfect:
Thanks for any suggestions, ideas, code snippets!