1 Position with different trades sent from different EA and how to check each comments

 

Hi, I have two EA trade the same product, each EA sent a buy market order to the market with different comments (EA1BUY1, EA2BUY2) , however, MT5 combine my two  trades as 1 position (netting mode) and if i am trying to find whats the comment of my position, it always return the latest trade comment only which is EA2BUY2, I used the below code to find the comment of my position, and what i want is i am trying to check if my position has both specific comment rather than just one.

bool IsThisPositionHasTheComment(string comment)

  {

   bool found=false;

   for (int i=PositionsTotal()-1; i>=0; i--)

     {

      ulong ticket=PositionGetTicket(i);

      if(ticket==0) continue;

      string s=PositionGetString(POSITION_COMMENT);

      if(s==comment)

        {

         found=true;

         break;

        }

     }

   return found;

  }

  Please Help, Thank you!

 
Please help this thanks
 
choisaac:
Please help this thanks

You also need to distinguish PositionGetInteger(POSITION_MAGIC)

then check if comments are the same as EA magic.

 

In a netting mode not really possible.

change your account to hede or find a solution


maybe you can draw a line into the chart to see the original position

Reason: