How can info be included on the 'comment' column when closing a trade?
-
I know how to do it viqa the 'buy/sell now' blocks, but I can't find the way to do it at the moment the trade is closed. Any suggestion?
-
@l-andorrà hI L-andorra, have you tried adding a string variable into the label box, and then under on trade, for each closed trade modify variable, and then after set time se variable back to blank.
This is how I would try, hope this helps, I have not tested but I have done similar things before.
-
I think it's only possible to include a comment when opening a trade. It cannot be changed afterwards.
-
@jstap Thank you for your answer. What do you mean by 'label box' exactly. I'm afraid I don't fully understand what you mean.
-
@rafaelgrecco That what I guess, but I'm not sure.
-
@l-andorrà It cannot be changed on MT4, but can be changed on MT5.
I believe we don't have a block for that function, so you would have create a Custom MQL Code block like this:
m_request.comment = PositionGetString(POSITION_COMMENT);
I'm not sure if you could just use a Close Position block and then use the Custom MQL Code block to change the comment or if you have to create the entire close function, something like:
m_request.action =TRADE_ACTION_DEAL;
m_request.position =ticket;
m_request.symbol =symbol;
m_request.volume =PositionGetDouble(POSITION_VOLUME);
m_request.magic =m_magic;
m_request.deviation=(deviation==ULONG_MAX) ? m_deviation : deviation;
m_request.comment = PositionGetString(POSITION_COMMENT); -
@l-andorrà Like this, maybe I have not understood your problem correctly but this is what I mean.

-
@jstap RIP ram, so many tabs opened

-
@jstap I'm afraid this is not what I was asking for, sorry. I know this block. What I need is insertig info on the 'comment' column of the MT4 history tab. Thank you for your interest anyways.
-
@rafaelgrecco I hate custom code.
Ok. I will try it. Thank you very much. -
@michaemia Yes it's called being lazy, but it stopes having to research (rubbish memory)

-
@l-andorrà No worries, what you need is beyond my expertise
