CTrade improvement sugestion - MQL5 Developers - Default Libs

 

Can the MQL5 developers add a comment parameter into the close positions CTrade methods?

I sugest to change these CTrade methods, adding the comment with a default value, like this:

   bool              PositionClose(const string symbol,const ulong deviation=ULONG_MAX, const string comment="");
   bool              PositionClose(const ulong ticket,const ulong deviation=ULONG_MAX, const string comment="");
   bool              PositionClosePartial(const string symbol,const double volume,const ulong deviation=ULONG_MAX, const string comment="");
   bool              PositionClosePartial(const ulong ticket,const double volume,const ulong deviation=ULONG_MAX, const string comment="");

I develop in hedge mode with several strategies on the same symbol and I use the comments to trace my operations. The problem is that close operations does not have any reference to trace easely how the operation was closed. With my sugestion, I'll be able to tag all IN/OUT operations, like below:

I created a subclass from CTrade to do this change, but I had to copy/paste the above methods. If the MQL5 change any code inside CTrade, my subclass will be outdated and cause hard-to-find bugs. The best solution is to make this change into the source.


Please, if here is not the right place to ask for this, tell me where and how I can ask by the change.

 

class MyCTrade : public CTrade

{

// ....

 
Rafael Caetano Pinto:

I suggest to change these CTrade methods, adding the comment with a default value, like this:

I added pretty much the same exact code to my copy of CTrade about a year ago. I agree that it is useful and something MetaQuotes might consider.

I tweaked the original library code rather than use the method @fxsaber suggests. His is the right way. It was just more expedient for me to scalpel it directly into the class library.

So, every time MetaQuotes releases a new version, it overwrites my changes, but I can quickly detect this because I use git on my local machine to track changes. If you aren't doing this, you might want to give it some thought.

Reason: