Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Return value of 'OrderClose' should be checked

  1. #1
    Senior Member fxtester's Avatar
    Join Date
    Nov 2008
    Posts
    3,164

    Default Return value of 'OrderClose' should be checked

    Replace

    Code:
    OrderClose(OrderTicket(),OrderLots(),Bid,Slippage);
    with :

    Code:
    bool result=false;
    
    result=OrderClose(OrderTicket(),OrderLots(),Bid,Slippage);

  2. #2
    Junior Member
    Join Date
    Oct 2009
    Posts
    4

    Default

    hi I have this comment too after compiled OrderClose Should be checked and OrderDelete too
    void closeall()
    {
    for(int i=OrdersTotal()-1; i>=0; i--)
    {
    if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==True)
    if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=magic) continue;
    if(OrderType()>1) OrderDelete(OrderTicket());
    else
    {
    if(OrderType()==0) OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NON E);
    else OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NON E);
    }
    }
    }
    So how can I fix this..
    Thanks

  3. #3
    Senior Member fxtester's Avatar
    Join Date
    Nov 2008
    Posts
    3,164

    Default

    Hi 43ossaossa,

    Code:
    void closeall(){
       bool resclose=false;
       for(int i=OrdersTotal()-1; i>=0; i--){
          if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==True)
             if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=magic)continue;
             if(OrderType()>1)resclose=OrderDelete(OrderTicket());
             else{
                if(OrderType()==0)resclose=OrderClose(OrderTicket(),OrderLots(),Bid,3,CLR_NONE);
                 else resclose=OrderClose(OrderTicket(),OrderLots(),Ask,3,CLR_NONE);
          }
       }
    }

Similar Threads

  1. OrderClose error 4108
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 02-11-2015, 20:42
  2. OrderClose error 138
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 02-11-2015, 20:39
  3. Return value of 'OrderModify' should be checked
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 08-11-2014, 08:32
  4. Return value of 'OrderSelect' should be checked
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 08-11-2014, 08:27

Tags for this Thread

slippage

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •