According to my observations - comment can be assigned to an "order" in one of the "pending" states:
1. BUY/SELL LIMIT or STOP
2. TP or SL orders for open positions
Position generated from LIMIT or STOP order, when filled, gets comment from source order.
Already filled position having not comment can be "commented" by assigning comment to TP or SL order.
But:
- when you assign "TP comment" to filled position already having comment received from LIMIT/STOP order - none of them is displayed
- when you assign comment to both "TP" and "SL" orders - position also displays nothing and keeps displaying nothing after removing comments from "TP" and "SL" orders
You can set that comment in "Orders" tab.
All this behavior is very strange to me. You may try asking for "API Support" to explain reasons behind all this.
PS: Here is what I see described in API for development of strategies and plugins.
/**
* Sets comment for pending orders.
*
* <p>By default, may not be called on the same order more often than once per second
* (exact value of max order update per second is sent by server).
*
* <pre>{@code
* if (order.getState() == IOrder.State.OPENED && order.getOrderCommand() != BUY && order.getOrderCommand() != SELL) {
* order.setComment("new_"+order.getComment());
* }
* }</pre>
*
* @param comment comment text
* @throws JFException if order is not in {@link State#OPENED} state
*/
void setComment(String comment) throws JFException;