Download MetaTrader 5

help with this close all open order once order is modified

To add comments, please log in or register
Chukwudi Joshua
179
Chukwudi Joshua  

please can some one help me with this script code,i have try everything yet not yet fix please i want this code to close all my open order one order is modified ,my code......thanks






extern int tp= 200;



int start()
{
double spread=Ask-Bid;

 int Ticket=OrderTicket();                            // Security name
 for( Ticket = OrdersTotal()-1;  Ticket >= 0 ;  Ticket--)
    {
 if(OrderSelect(Ticket,SELECT_BY_POS, MODE_TRADES)==true)
       if(OrderSymbol()!=Symbol()) // with current chart symbol 
       continue; 
{
if (OrderType() == OP_BUY && iMA(NULL,0,1,0,MODE_LWMA,PRICE_LOW,0) > OrderOpenPrice()) {
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderOpenPrice()+tp*MarketInfo(OrderSymbol(),MODE_POINT),0,Green);}
 OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Yellow );
}          
if (OrderType() == OP_SELL && iMA(NULL,0,1,0,MODE_LWMA,PRICE_HIGH,0) < OrderOpenPrice()) {
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderOpenPrice()-tp*MarketInfo(OrderSymbol(),MODE_POINT) + spread,0,Green);}
 OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Yellow );
}
return;
}//+------------------------------------------------------------------+
Chukwudi Joshua
179
Chukwudi Joshua  
please anybody with ideal on how to fix this script,
Chukwudi Joshua
179
Chukwudi Joshua  
please am still waiting
Stuart Browne
6503
Stuart Browne  
What seems to be the problem? What errors are you getting?
Chukwudi Joshua
179
Chukwudi Joshua  
Filter:
What seems to be the problem? What errors are you getting?




thanks Filter: for more than one month now i have been looking for solution but i fix it to night with my hands thanks for you attention. in recommendation

of your instruction i will learn to code in error code for checks and possible corrections,

Stuart Browne
6503
Stuart Browne  
No problem mate, glad you got it sorted :)
To add comments, please log in or register