Download MetaTrader 5
To add comments, please log in or register
Millions of traders download codes from MQL5 library. Share your app with them!
Agent86
915
Agent86 2015.01.16 14:00 
Hi

I have 2 buffers exactly the same except one is LOWER_MODE and the other is UPPER_MODE

Alow() works fine while Bhigh() creates Meta Editor errors


'B' - some operator expected    ABCDtrade.mq4    116    7
expression has no effect    ABCDtrade.mq4    116    11
possible use of uninitialized variable 'B'    ABCDtrade.mq4    117    10
1 error(s), 2 warning(s)        2    3


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---

if(Alow()!=0)Alow();
  
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+


double Alow()
{
   int i;
   double A;
   double fraclow=iFractals(NULL, 0, MODE_LOWER,3);
   
   for (i=0; fraclow == 0; i++)
      {
      fraclow = iFractals(NULL,0,MODE_LOWER,i);
      A=fraclow;
      if(A!=0)
      return(frlow1[i]=A);     
      }
      
return(0);          
}


double Bhigh()
{
   int i;
   double B;
   double frachigh=iFractals(NULL, 0, MODE_UPPER,3);
   //double faster=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,1);//MODE_MAIN
   //double slower=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1); //MODE_SIGNAL
   
   for (i=0; frachigh == 0; i++)
      {
      frachigh = iFractals(NULL,0,MODE_UPPER,i)
      B = frachigh;
      if(B!=0)
      return(frhigh1[i]=B);
      }
           
return(0);     
}
Both the same as far as i can tell, so why Bhigh() errors ?
Alain Verleyen
Moderator
28672
Alain Verleyen 2015.01.16 16:07  
      frachigh = iFractals(NULL,0,MODE_UPPER,i);
Agent86
915
Agent86 2015.01.16 18:09  
angevoyageur:

HA HA,  oh crap

Thanks

/
To add comments, please log in or register