-----------------------------OrderModify & OrderSelect should be check-----------------------------

 

Hi Coders,

I get 4 warnings when I Compile my EA, Please help me out to fix this. Many Many Thanks. The warnings are highlighted as Red colour.



warnings are below

void function returns a value.

Return Value of "OrderModify" should be check.

Return Value of "OrderModify" should be check.

Return Value of "OrderSelect" should be check.



Thanks



Codes Below

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

   extern double LotSize = 0.01;
   extern int BollingerPeriod = 20;
   extern int BollingerDeviation = 2;
   double MagicNumber = 111;
   double pips;
  
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+

int OnInit()
  {
//---
   double ticksize =MarketInfo (Symbol(),MODE_TICKSIZE);
   if (ticksize == 0.00001 || ticksize == 0.001)
   pips = ticksize*10;
   else pips = ticksize;
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
  void OnTick()
  {
   if(IsNewCandle()) 
   CheckForBollingerBandTrade();
  
//---
   return(0);
  }

//+------------------------------------------------------------------+
void CheckForBollingerBandTrade ()
{
   double MiddleBB = iBands(NULL,0,BollingerPeriod,BollingerDeviation,0,0,MODE_MAIN,1);
   double LowerBB = iBands(NULL,0,BollingerPeriod,BollingerDeviation,0,0,MODE_LOWER,1);
   double UpperBB = iBands(NULL,0,BollingerPeriod,BollingerDeviation,0,0,MODE_UPPER,1);
   double PrevMiddleBB = iBands(NULL,0,BollingerPeriod,BollingerDeviation,0,0,MODE_MAIN,2);
   double PrevLowerBB = iBands(NULL,0,BollingerPeriod,BollingerDeviation,0,0,MODE_LOWER,2);
   double PrevUpperBB = iBands(NULL,0,BollingerPeriod,BollingerDeviation,0,0,MODE_UPPER,2);
   if(Close[1]>Open[1]&&Low[1]<LowerBB&&Open[1]-Low[1]>((Close[1]-Open[1])*2))OrderEntry(0); 
   if(Close[1]<Open[1]&&High[1]>UpperBB&&High[1]-Open[1]>((Open[1]-Close[1])*2))OrderEntry(1);
  
}  
//+------------------------------------------------------------------+

void OrderEntry (int direction)
{

   if (direction ==0)
   {
      if (OpenOrdersThisPair(Symbol())==0)
      int buyticket = OrderSend ( Symbol(),OP_BUY,LotSize,Ask,3,0,0,NULL,MagicNumber,0,clrGreen);
      if (buyticket>0)OrderModify(buyticket,OrderOpenPrice(),Low[1],(Close[1]+((Close[1]-Low[1])*2)),0,clrNONE);
   }
   if (direction==1)
   {
   if(OpenOrdersThisPair(Symbol())==0)
   int sellticket = OrderSend(Symbol(),OP_SELL,LotSize,Bid,3,0,0,NULL,MagicNumber,0,clrRed);
   if(sellticket>0)OrderModify(sellticket,OrderOpenPrice(),High[1],(Close[1]-((High[1]-Close[1])*2)),0,clrNONE);
   }
}
//+------------------------------------------------------------------+
int OpenOrdersThisPair (string pair)
{
   int total=0;
   for(int i=OrdersTotal()-1; i >=0;i--)
   {
   OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
   if(OrderSymbol ()== pair) total++;
   }
   return (total);
}
//+------------------------------------------------------------------+
bool IsNewCandle ()
{
   static int BarsOnChart=0;
   if (Bars == BarsOnChart)
   return (false);
   BarsOnChart = Bars;
   return(true);
}

 

How many more times can these same questions be asked and answered?

Paste it into Google search

OrderModify & OrderSelect should be checked

 
joe217227:

Hi Coders,

I get 4 warnings when I Compile my EA, Please help me out to fix this. Many Many Thanks. The warnings are highlighted as Red colour.

. . .


Please read ----> What are Function return values ? How do I use them ?
Reason: