looking for a way to close my open order by a certain amount of profit is it possible??

 

I 'm looking a way to close my open order by a certain amount of profit is it possible ?? or do i have to close my open order only when the price is above the orderPrice ?? here is my code that close an open order:

 for(PositionIndex=TotalNumberOfOrders-1; PositionIndex>=0; PositionIndex --)
     {

                                      if(!OrderSelect(PositionIndex,SELECT_BY_POS,MODE_TRADES))

         if((OrderMagicNumber()==ticket1 || OrderMagicNumber()==ticket2) && OrderSymbol()=="EURUSD" && (ticket1==OP_BUY || ticket2==OP_SELL))//
              
               
                                      if(OrderType()==OP_SELL   )//SELL ORDER On Positif TRADE

                                      if(!OrderClose(ticket2,0.01,Bid-Price*Point ,clrNONE))


                 Print("Order Close failed, order number: ",ticket2," Error: ",GetLastError());
         
                                      if(OrderType()==OP_BUY   )//BUY ORDER On Positif TRADE

                                      if(!OrderClose(ticket1,0.01,Ask+Price*Point,5,clrNONE))
            
          
                 Print("Order Close failed, order number: ",ticket1," Error: ",GetLastError());
            
 
            
     }
 
Are you asking about a Take Profit order? If you isse an OrderClose request, you have to use current market value. Something different is a Limit order. Not sure what you are asking about...
 
Well let say when my BUY pending order is hit at 1.1373 EURUSD  and i want my EA to close that order at 1.1378 that is what i'm talking about.
 
These will not work. You can only close an order at current market price.
if(!OrderClose(ticket2,0.01,Bid-Price*Point ,clrNONE))
if(!OrderClose(ticket1,0.01,Ask+Price*Point,5,clrNONE))
i want my EA to close that order at 1.1378
When you open the order, set the TP at that price and it will close itself.
Reason: