Expiry date

 
void OnInit() 
{ 

   ArrayResize(text,26);  
   
   int digits=(int)MarketInfo(Symbol(),MODE_DIGITS);
   double bid=(int)MarketInfo(Symbol(),MODE_BID);
   
   if(digits==4 || (bid<1000 && digits==2)){ Pip=1;} else Pip=10;
   
   if(IsTesting()) prefix="Test"+IntegerToString(MagicNumber); 
   else prefix=IntegerToString(MagicNumber);
   
   
   
    datetime expiryDate = D'2021.10.28';
   if(TimeCurrent() > expiryDate)
     {
      Alert("Expired copy. Please contact Fox Wave QCW");
      return(INIT_FAILED);
     }
   
   return(INIT_SUCCEEDED);  
}
please what's wrong with me ?
 
 double bid=(int)MarketInfo(Symbol(),MODE_BID);
  1. Bid is not an int. Fails on almost all symbols.

    PIP, Point, or Tick are all different in general.
              What is a TICK? - MQL4 programming forum #35 (2014)

    Unless you manually adjust your SL/TP for each separate symbol, using Point means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points), and metals. Compute what a PIP is and use it, not points.
              How to manage JPY pairs with parameters? - MQL4 programming forum (2017)
              Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum (2018)

  2. Don't try to use any price (or indicator) or server related functions in OnInit (or on load or in OnTimer before you've received a tick), as there may be no connection/chart yet:
    1. Terminal starts.
    2. Indicators/EAs are loaded. Static and globally declared variables are initialized. (Do not depend on a specific order.)
    3. OnInit is called.
    4. For indicators OnCalculate is called with any existing history.
    5. Human may have to enter password, connection to server begins.
    6. New history is received, OnCalculate called again.
    7. A new tick is received, OnCalculate/OnTick is called. Now TickValue, TimeCurrent, account information and prices are valid.
 

thank you, I'm talking about the expiry date, I added that there, and it has a problem with the return


 
Zbynek Liska #: thank you, I'm talking about the expiry date, I added that there, and it has a problem with the return
void OnInit() { 
   ⋮
   return(INIT_SUCCEEDED);  

No, you're not.  Your problem is a void OnInit(). Void functions can not return values.

The OnInit() function of the void type always denotes successful initialization.
          Event Handling Functions - Functions - Language Basics - MQL4 Reference

 
that's it, thank you very much :)