Download MetaTrader 5
To add comments, please log in or register
Improve your rating. Execute orders in Freelance service!
mrwayne
252
mrwayne 2014.04.03 16:38 


It should have already return a value of 50 for all time frame, however the new complier insists that I need to return a value outside the switch brackets ...

qjol
3243
qjol 2014.04.03 17:00  
//+------------------------------------------------------------------+
//| Program's sub-function                                           |   
//+------------------------------------------------------------------+
   int ReadMaxHistoricalBars ( int Interval )
   {
   
      switch ( Interval )
      {
         case PERIOD_MN1 : return ( 50 ) ;
         case PERIOD_W1  : return ( 50 ) ;
         case PERIOD_D1  : return ( 50 ) ;
         case PERIOD_H4  : return ( 50 ) ;
         case PERIOD_H1  : return ( 50 ) ;
         case PERIOD_M30 : return ( 50 ) ;
         case PERIOD_M15 : return ( 50 ) ;
         case PERIOD_M5  : return ( 50 ) ;
         case PERIOD_M1  : return ( 50 ) ;
         default:          return (  0 ) ; //or whatever you want
      }
      
   }
//+------------------------------------------------------------------+
mrwayne
252
mrwayne 2014.04.03 17:45  
Okay somethings wrong after doing that
qjol
3243
qjol 2014.04.03 18:30  
you can return whatever you want aiready written above
//or whatever you want

but this is not the problem

//+------------------------------------------------------------------+
//| Program's sub-function                                           |   
//+------------------------------------------------------------------+
   int ReadMaxHistoricalBars ( int Interval )
   {
   
      switch ( Interval )
      {
         case PERIOD_MN1 :
            return ( 50 );
            break;
         case PERIOD_W1  :
            return ( 50 ) ;
            break;
         case PERIOD_D1  :
            return ( 50 ) ;
            break;
         case PERIOD_H4  :
            return ( 50 ) ;
            break;
         case PERIOD_H1  :
            return ( 50 ) ;
            break;
         case PERIOD_M30 :
            return ( 50 ) ;
            break;
         case PERIOD_M15 :
            return ( 50 ) ;
            break;
         case PERIOD_M5  :
            return ( 50 ) ;
            break;
         case PERIOD_M1  :
            return ( 50 ) ;
            break;
         default:
            return (  0 ) ;
            break; //or whatever you want
      }
      
   }
//+------------------------------------------------------------------+
qjol
3243
qjol 2014.04.03 18:39  
excuse me sir but all the errors you are talking about is not related in any way to B600>
it's basics in programing
mrwayne
252
mrwayne 2014.04.03 18:42  
its fine before 600
Keith Watford
Moderator
7899
Keith Watford 2014.04.03 18:44  
juniorlcq:

I can't compile this part too at strict .... the last if's acquiredbars needs declare ... but i already declare it at the 2nd for loop


AcquiredBars is local to the 2nd for loop.

If you need to retain the value between different blocks of code declare it before the for()


int AcquiredBars;   //Declare it here
for ( int i = 0 ; i < 10 ; i++ ) 
    //int AcquiredBars    //Or here
         {
            for ( int x = 0 ; x < TotalPairs ; x++ )
            {
               AcquiredBars = iBars ( MajorPairs[x] , Interval ) ;
               
               
               
               if ( Error != 0 || AcquiredBars < HistoricalBars )
               {
                  continue ;
               }
               else
               {
                  break ;
               }
            }
            
            
            
               if ( i == 9 && ( Error != 0 || AcquiredBars < HistoricalBars ) )
               {
                  return ( False ) ;
               }
         }
mrwayne
252
mrwayne 2014.04.03 18:47  
ok thank you, it becomes warning now
Alain Verleyen
Moderator
28552
Alain Verleyen 2014.04.03 21:34  
juniorlcq:
ok thank you, it becomes warning now
Common Errors in MQL4 Programs and How to Avoid Them
/
To add comments, please log in or register