Download MetaTrader 5

help with this close all open order once order is modified

To add comments, please log in or register
One billion tasks have already been executed with MQL5 Cloud Network. Test trading robots even faster!
chukwudi joshua
232
chukwudi joshua 2015.04.07 15:14 

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
232
chukwudi joshua 2015.04.07 18:23  
please anybody with ideal on how to fix this script,
chukwudi joshua
232
chukwudi joshua 2015.04.08 03:12  
please am still waiting
Stuart Browne
5801
Stuart Browne 2015.04.08 03:25  
What seems to be the problem? What errors are you getting?
chukwudi joshua
232
chukwudi joshua 2015.04.08 08:31  
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
5801
Stuart Browne 2015.04.08 08:43  
No problem mate, glad you got it sorted :)
To add comments, please log in or register