求助!如何寫EA限制日期呢?

 

求助!如何寫EA限制日期呢?

//寫入時間限制

void timeout()

   {

      if (TimeCurrent()>D'2022.4.8')

         {

            Comment("軟體過期!");

            return(0);

         }

   }

這樣寫錯在何處呢? 照書本上寫的卻不能用,請高手幫我修改一下如果使用到期了就跳出程式,我寫的是 MT4用的,另外我想加寫限制帳號使用。請一並教我好嗎? 謝謝!!

 

FYI.

//+------------------------------------------------------------------+
//|                                             test_expiry_date.mq5 |
//|                                           Copyright 2022,fxMeter |
//|                           https://www.mql5.com/en/users/fxmeters |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022,fxMeter"
#property link      "https://www.mql5.com/en/users/fxmeters"
#property version   "1.00"

datetime deadline = D'2022.12.31';
ulong    authorizedAccount = 123456;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
//---
   if(TimeCurrent()>deadline)
   {
      Alert("...something...");
      return(INIT_FAILED);
   }
   if(AccountInfoInteger(ACCOUNT_LOGIN)!=authorizedAccount)
   {
      Alert("...unauthorized account...");
      return(INIT_FAILED);
   }
//---
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---

}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
//---

}
//+------------------------------------------------------------------+
 
Ziheng Zhuang #:

FYI.

感謝高手的指教,希望能跟你交個朋友,以後有機會可以合作。

原因: