Download MetaTrader 5

Help in Break Even

To add comments, please log in or register
Hany Taha
25
Hany Taha  

Hello dear Traders :
******************


I need to make Break Even for 2 orders with the same symbol simultaneously


I get error 130 and error 1
Any Ideas?

Here is the code :

 

void Break_Even() { {   if(OpenOrdersThisPair(Symbol())==2)   if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))   if(OrderMagicNumber()==MagicNumber)   if(OrderSymbol()==Symbol())   if(OrderType()==OP_BUY)   if(Ask-OrderOpenPrice() >= NormalizeDouble(BreakEvenPercent*(OrderTakeProfit()-OrderOpenPrice()),Digits))   if(OrderOpenPrice() > OrderStopLoss())    {     modify=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice(),OrderTakeProfit(),0);    }     OpenPrice=OrderOpenPrice();     select=OrderSelect(1,SELECT_BY_POS,MODE_TRADES);    {     modify=OrderModify(OrderTicket(),OrderOpenPrice(),OpenPrice,OrderTakeProfit(),0);    }        } }





Keith Watford
Moderator
10651
Keith Watford  

    select=OrderSelect(1,SELECT_BY_POS,MODE_TRADES);
   {
    modify=OrderModify(OrderTicket(),OrderOpenPrice(),OpenPrice,OrderTakeProfit(),0);
   } 
This is completely independent of any conditions so will be executed every time the function is called.
Hany Taha
25
Hany Taha  
This is completely independent of any conditions so will be executed every time the function is called.
Thnx for tip
Hany Taha
25
Hany Taha  
Thnx Guys EA Done!! :D
To add comments, please log in or register