wanghsinfu 發表於 16-8-10 07:59

MT4 請教高手計時器問題

我想設定 每天 在下列計時器內才執行程式內容。
目前只能跑一天,隔天就不會正常執行了。
問題出在哪裡呢?
請高手指教一下謝謝!!

if (TimeCurrent()>D'08:00' && TimeCurrent()<D'22:00')
{
程式內容
}

wanghsinfu 發表於 16-8-11 06:06

我改成這樣子,顯示數值都對;可還是一樣,第一天都正常,隔天就不能執行了。

      #property strict
      int hh;
      int mmm;
      int ss;
int start()
{
      UserTime();    //判斷時間內執行程式
}


void UserTime()
{      
      int starthh=8;    //開始小時
      int stophh=22;    //結束小時
      
      UserTimeTemp=TimeCurrent();
      hh=TimeHour(TimeCurrent());   //伺服器時間 小時
      mmm=TimeMinute(TimeCurrent());//伺服器時間 分鐘
      ss=TimeSeconds(TimeCurrent());//伺服器時間 秒鐘
      //Comment (UserTimeTemp+""+hh+":"+mmm+":"+ss);
      //Sleep (1000);
   if (hh>starthh && hh<stophh)
      {
      程式執行
      }
}

wanghsinfu 發表於 16-8-12 07:37

結果還是不行

顯示數值都對;可還是一樣,第一天都正常,隔天就不能執行了。
頁: [1]
查看完整版本: MT4 請教高手計時器問題