set comment to partially close position

 

hello,

i got trouble with realize position that already partial closed and EA again and again close partially after price reach a level.

So that i would like to set comment to position that already partial closed, could somebody help me in coding this. Thanks!

 
tanh141:

hello,

i got trouble with realize position that already partial closed and EA again and again close partially after price reach a level.

So that i would like to set comment to position that already partial closed, could somebody help me in coding this. Thanks!

Not possible to modify comments. It is not good to do that as brokers may change comments.

 
Yashar Seyyedin #:

Not possible to modify comments. It is not good to do that as brokers may change comments.

Ok,  I just want to use comment to manage opened positions. May be i find better another way to manage this via current volume and initial volume of order. Thanks

 
tanh141 #:

Ok,  I just want to use comment to manage opened positions. May be i find better another way to manage this via current volume and initial volume of order. Thanks

Try this.

bool IsPositionPartial() { return(PositionGetInteger(POSITION_TIME_MSC) != PositionGetInteger(POSITION_TIME_UPDATE_MSC)); }
 
tanh141 #: May be i find better another way to manage this via current volume and initial volume of order.

fxsaber has given one suggestion, not available on MT4.

You also must check if you have already done it, to avoid repeated closing. Alternatives:

  • Move SL to Break Even+1 before the partial close. That way, you know that you already did it.
  • Set a flag in persistent storage (files, global variables w/flush)
  • Open two orders initially, and close one (manually or by TP.)
 
William Roeder #:

fxsaber has given one suggestion, not available on MT4.

You also must check if you have already done it, to avoid repeated closing. Alternatives:

  • Move SL to Break Even+1 before the partial close. That way, you know that you already did it.
  • Set a flag in persistent storage (files, global variables w/flush)
  • Open two orders initially, and close one (manually or by TP.)

Yes, in MT5 it's working with DEAL_VOLUME via deal history. Your ways is also good to manage Position that already partial closed