Download MetaTrader 5

Pozisyonları Ticket Id ile Kapatma(CloseOrder By Order Ticket)

To add comments, please log in or register
Suat Yuksel
9
Suat Yuksel  
extern double lot1=1.0;
extern double OrderTicket1= 0;
extern double lot2 =0.10;
extern double OrderTicket2 =0 ;
extern double lot3 =0.01;
extern double OrderTicket3 =0 ;
extern double lot4 =0.23;
extern double OrderTicket4 =0 ;
extern double lot5 =0.20;
extern double OrderTicket5 =0 ;
int start()
{
  int total = OrdersTotal();
  
  for(int i=0;i<total;i++)
  {
    OrderSelect(i, SELECT_BY_POS);
    int type   = OrderType();

    bool result = false;
    
    switch(type)
    {
      //Alışları kapat
      
     case OP_BUY       :  result = OrderClose( OrderTicket1, lot1, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red )&& OrderClose( OrderTicket2, lot2, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red )&& OrderClose( OrderTicket3, lot3, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red )&& OrderClose( OrderTicket4, lot4, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red )&& OrderClose( OrderTicket5, lot5, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
                          break;
    
                          
      
      //Satışları kapat
      case OP_SELL      : result = OrderClose( OrderTicket1, lot1, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red )&& OrderClose( OrderTicket2, lot2, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red )&& OrderClose( OrderTicket3, lot3, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red )&& OrderClose( OrderTicket4, lot4, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red )&& OrderClose( OrderTicket5, lot5, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
                          break;
                        

    
    }
    
    if(result == false)
    {
     // Alert("Order " , OrderTicket() , " Kapanmadı" , GetLastError() );
      Sleep(3000);
    }  
  }
  
  return(0);
Keyvan Naserian
335
Keyvan Naserian  
it is good program
To add comments, please log in or register