Return value of 'OrderSelect' should be checked

 
Hi everyone,

I'm not a coder but I've tried a few free online EA builder to get my strategy tested.
I'm getting a few warning such as the topic subject "Return value of 'OrderModify' should be checked".
I have no idea what this is but I would be great if you genius coder here could help me out.

Thanks in advance
extern int MagicNumber=6257242;
extern double Lots =0.1;
extern double StopLoss=20;
extern double TakeProfit=0;
extern int TrailingStop=2;
extern int Slippage=3;
//+------------------------------------------------------------------+
//    expert start function
//+------------------------------------------------------------------+
int start()
{
  double MyPoint=Point;
  if(Digits==3 || Digits==5) MyPoint=Point*10;
  
  double TheStopLoss=0;
  double TheTakeProfit=0;
  if( TotalOrdersCount()==0 ) 
  {
     int result=0;
     if((Close[0]>iMA(NULL,0,88,0,MODE_SMA,PRICE_CLOSE,0))) // Here is your open buy rule
     {
        result=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Blue);
        if(result>0)
        {
         TheStopLoss=0;
         TheTakeProfit=0;
         if(TakeProfit>0) TheTakeProfit=Ask+TakeProfit*MyPoint;
         if(StopLoss>0) TheStopLoss=Ask-StopLoss*MyPoint;
         OrderSelect(result,SELECT_BY_TICKET);
         OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
        }
        return(0);
     }
     if((Close[0]<iMA(NULL,0,88,0,MODE_SMA,PRICE_CLOSE,0))) // Here is your open Sell rule
     {
        result=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Red);
        if(result>0)
        {
         TheStopLoss=0;
         TheTakeProfit=0;
         if(TakeProfit>0) TheTakeProfit=Bid-TakeProfit*MyPoint;
         if(StopLoss>0) TheStopLoss=Bid+StopLoss*MyPoint;
         OrderSelect(result,SELECT_BY_TICKET);
         OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
        }
        return(0);
     }
  }
  
  for(int cnt=0;cnt<OrdersTotal();cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELL &&   
         OrderSymbol()==Symbol() &&
         OrderMagicNumber()==MagicNumber 
         )  
        {
         if(OrderType()==OP_BUY)  
           {
            if(TrailingStop>0)  
              {                 
               if(Bid-OrderOpenPrice()>MyPoint*TrailingStop)
                 {
                  if(OrderStopLoss()<Bid-MyPoint*TrailingStop)
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*MyPoint,OrderTakeProfit(),0,Green);
                     return(0);
                    }
                 }
              }
           }
         else 
           {
            if(TrailingStop>0)  
              {                 
               if((OrderOpenPrice()-Ask)>(MyPoint*TrailingStop))
                 {
                  if((OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0))
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyPoint*TrailingStop,OrderTakeProfit(),0,Red);
                     return(0);
                    }
                 }
              }
           }
        }
     }
   return(0);
}

int TotalOrdersCount()
{
  int result=0;
  for(int i=0;i<OrdersTotal();i++)
  {
     OrderSelect(i,SELECT_BY_POS ,MODE_TRADES);
     if (OrderMagicNumber()==MagicNumber) result++;

   }
  return (result);
}
 
futurem:"Return value of 'OrderModify' should be checked".
What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
futurem: tried a few free online EA builder
  1. We hate EA builder
  2. You couldn't be bothered to learn mql4, therefor there is no common language for us to communicate.
  3. There are only two choices: learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds lines of code.
  4. EA builder makes bad code counting up while closing multiple orders.
  5. EA builder makes bad code Bars is unreliable (max bars on chart) volume is unreliable (miss ticks) Always use time
  6. EA builder makes bad code Not adjusting for 4/5 digit brokers
  7. EA builder makes bad code not adjusting for ECN brokers.
  8. EA builder makes bad code not checking return codes.
 
futurem:
Hi everyone,

I'm not a coder but I've tried a few free online EA builder to get my strategy tested.
I'm getting a few warning such as the topic subject "Return value of 'OrderModify' should be checked".

Now you have direct experience of how bad the EA builder apps are . . .
 
WHRoeder:
futurem:"Return value of 'OrderModify' should be checked".
What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
futurem: tried a few free online EA builder
  1. We hate EA builder
  2. You couldn't be bothered to learn mql4, therefor there is no common language for us to communicate.
  3. There are only two choices: learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds lines of code.
  4. EA builder makes bad code counting up while closing multiple orders.
  5. EA builder makes bad code Bars is unreliable (max bars on chart) volume is unreliable (miss ticks) Always use time
  6. EA builder makes bad code Not adjusting for 4/5 digit brokers
  7. EA builder makes bad code not adjusting for ECN brokers.
  8. EA builder makes bad code not checking return codes.

Thanks man.. appreciate that. Guess I need to learn or pay someone then. And probably stop using EA builders too.. :)
 
RaptorUK:
Now you have direct experience of how bad the EA builder apps are . . .


Hahahahaha.. yeah you are right. I used to learn C++ way back but almost forgot everything. By the way, I have high respect for you coders.. you guys are geniuses. 
 
And a bit of practice ... XD
Reason: