OrderComment BUG!!!

 
During these days I have noticed that the new versions (from 600 to 610 currently in use) have an annoying bug related to the property OrderComment, in practice if the comment is longer than 32 characters is omitted without any prior notice.

For those trading systems that use the reading of the comment to distinguish the type of order strategy is a big problem. Currently, the work-around is to shorten the comment. We hope that soon this bug will be solved.
 
If you search the forum, you'll find a lot of references to it, and it's not a new at all, known for years
 

One thing is to say "comments are not reliable" and an other is there is no comment without warning message. Until build 509 all comments have worked fine.

I am not referring to the modification of the comments after a partial closure, but the original comment in the opening position.

 
Dainesi:

One thing is to say "comments are not reliable" and an other is there is no comment without warning message. Until build 509 all comments have worked fine.

I am not referring to the modification of the comments after a partial closure, but the original comment in the opening position.

Up to build 509 comment are automatically truncated after the 31th, without any warning message. The only bug in my opinion is in the documentation who don't mention this limitation.

It's a bad coding practice to base your code on information that can be changed by the broker without any warning. Maybe it's time to find a more reliable way ?

 
angevoyageur:

Up to build 509 comment are automatically truncated after the 31th, without any warning message. The only bug in my opinion is in the documentation who don't mention this limitation.

It's a bad coding practice to base your code on information that can be changed by the broker without any warning. Maybe it's time to find a more reliable way ?




But a such response is not enough for solve a lot of interest linked to comments.

I don't wanna talk about comment after a partial closing but the comment after the opening! I have seen that if the waited comment is longer than 32 character what appears is a couple of brackets with magic number inside.

Nowadays we work with 64 bits OS, the millenium bug is so far from us but a comment still preserves a lenght limit! No truncate solution (at least) but a substitution!! Let's think an EA that generates hedge orders linked to a specific base order (i.e. #567) and every hedge order have to report in comment their pedigree with a special string into the comment (i.e. "Hedge of #567# "). We can have some base orders and for every ones we can have one or more hedge orders. To keep EA secure, transportable and get full fail over compliance, we need to incorporate infos in the comment (best solution will be to add a field "TAG" in the order properties...). We can't think to work with Platform variables or file I/O (if I have to change PC these information will be lost).

I think that the solution is simple: in the struct/class of the order, enlarge the variable size from nchar to varchar and change the feature of comment rendering from substitution solution to truncate (in case of nchar).

P.S. I send also this post in Highlight thead "MetaTrader 4 Client Terminal build 646: New Smart Search, Books in the Market and Updated Window of MQL4 Application Settings", because of in the latest version of the platform (646) the bug persists again.

 
Dainesi:

But a such response is not enough for solve a lot of interest linked to comments.

I don't wanna talk about comment after a partial closing but the comment after the opening! I have seen that if the waited comment is longer than 32 character what appears is a couple of brackets with magic number inside.

Nowadays we work with 64 bits OS, the millenium bug is so far from us but a comment still preserves a lenght limit! No truncate solution (at least) but a substitution!! Let's think an EA that generates hedge orders linked to a specific base order (i.e. #567) and every hedge order have to report in comment their pedigree with a special string into the comment (i.e. "Hedge of #567# "). We can have some base orders and for every ones we can have one or more hedge orders. To keep EA secure, transportable and get full fail over compliance, we need to incorporate infos in the comment (best solution will be to add a field "TAG" in the order properties...). We can't think to work with Platform variables or file I/O (if I have to change PC these information will be lost).

I think that the solution is simple: in the struct/class of the order, enlarge the variable size from nchar to varchar and change the feature of comment rendering from substitution solution to truncate (in case of nchar).

P.S. I send also this post in Highlight thead "MetaTrader 4 Client Terminal build 646: New Smart Search, Books in the Market and Updated Window of MQL4 Application Settings", because of in the latest version of the platform (646) the bug persists again.

Don't lost your time arguing about how order's comment should be, there is no bug at all. It's a fact that it can't be used reliably, so you have to find an other way.
 
If something is not reliable then why is there? This is not an argument but an encouragement to make a reliable feature, that for your own admission now it is not.
 
angevoyageur:
Don't lost your time arguing about how order's comment should be, there is no bug at all. It's a fact that it can't be used reliably, so you have to find an other way.


The documentation for OrderComment states: "comment=NULL [in] Order comment text. Last part of the comment may be changed by server."

I have found the OrderComment to be extremely reliable and usefull in coding strategies for placing opposing pending orders just prior to news or economic report times just by adding to the comment a sequence number that identifies the pair of orders.

The comment placed by the expert remains intact until the order is closed at which time the servers of some brokers append "sl" or "tp".

It is horrendous to try another way like using a different OrderMagicNumber for each pair becomes a nightmare!

Should the Broker alter the behaviour of OrderComment() and does not notify you then you can claim or certainly make sure that the Broker gets a bad press report.

 
sxTed: It is horrendous to try another way like using a different OrderMagicNumber for each pair becomes a nightmare!

Why would you need to do that. Filter by magic number and pair in the OrderSelect loop. Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum

Use a range of numbers to differentiate different timeframes or different strategies.

 
WHRoeder:

Why would you need to do that. Filter by magic number and pair in the OrderSelect loop. Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum

Use a range of numbers to differentiate different timeframes or different strategies.

Your suggestion has merit, however report trading strategy is usually run automatically from one expert filtering a csv file which lists the multi currency reports to be carried out for the next week.

 
sxTed:

Your suggestion has merit, however report trading strategy is usually run automatically from one expert filtering a csv file which lists the multi currency reports to be carried out for the next week.

If we operate in professional way we cannot use i/o streaming. Using files force the strategy to follow the client life. What's happen if an electrical shutdown occurs? We are lost and all our trades too. No, thanks you! I must be able to activate a secondary client that reads all necessary info and get full control of the strategy.

The solution is a new field in Order properties: Tag. Like in other object (class object) the Tag property is a multi purpose field, useful for storage extra info. If in MetaQuotes don't want implement such a field, at least enlarge the size of OrderComment property and set reliable his content.

Reason: