Download MetaTrader 5
To add comments, please log in or register
Register as a seller and start making profit!
Abdou Solyman
135
Abdou Solyman 2014.04.11 09:51 

after the last update my EA stopped open new trades when i check it for errors it gives me this message

return value of 'OrderSelect' should be checked


 

this the code

  {

 OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

      if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;

      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {

         if (OrderType() == OP_BUY) {

            LongTrade = TRUE;

            ShortTrade = FALSE;

            break;

         }

      }

      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {

         if (OrderType() == OP_SELL) {

            LongTrade = FALSE;

            ShortTrade = TRUE;

            break;

         }

      }

   }  

Paul Anscombe
3866
Paul Anscombe 2014.04.11 14:50  
abdouamer:

after the last update my EA stopped open new trades when i check it for errors it gives me this message


use the SRC button to attach the code otherwise it is no very easy to read

 

and see this  https://www.mql5.com/en/docs/trading/orderselect

Documentation on MQL5: Trade Functions / OrderSelect
Documentation on MQL5: Trade Functions / OrderSelect
  • www.mql5.com
Trade Functions / OrderSelect - Documentation on MQL5
Alain Verleyen
Moderator
28535
Alain Verleyen 2014.04.11 15:05  
abdouamer:

after the last update my EA stopped open new trades when i check it for errors it gives me this message

...

Forum on trading, automated trading systems and testing trading strategies

Hello,

This forum is about MT5/mql5, please post your question about MT4/mql4 on mql4.com forum.

  • They are more people who can answer there.
  • They are more people who can have similar problem there.
  • A forum is not only to get help but to share with the community, mql4/MT4 community isn't the same as mql5/MT5 community.
Actually, the message you get is not an error but a warning.
Osama Shaban
1302
Osama Shaban 2015.04.03 23:56  
Upload your's and I will do it for you.
Biantoro Kunarto
13780
Biantoro Kunarto 2015.04.04 05:21  

Change to this

   
   {
      if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
         {
            if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
            if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) 
               {
                  if (OrderType() == OP_BUY) 
                     {
                        LongTrade = TRUE;
                        ShortTrade = FALSE;
                        break;
                     }
               }
            if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) 
               {
                  if (OrderType() == OP_SELL) 
                     {
                        LongTrade = FALSE;
                        ShortTrade = TRUE;
                        break;
                     }
               }
         }
   }
/
To add comments, please log in or register