|
本帖最後由 wicebing 於 14-4-21 00:36 編輯
//先編譯一組函數 _Season
Vars: Mn(0),Wk(0),Dy(0),now(0),_Season(0) ;
Now = date;
Mn = Month(Now);
Dy = dayofweek(Now);
If Mn <> Mn[1] then Wk = 1;
//If Dy = 0 and Dy <> Dy[1] then Wk = Wk + 1;
If Dayofmonth(Now)<>1 and Dy = 1 and Dy <> Dy[1] then Wk = Wk + 1;
Condition1 = Mn > 3 and Mn < 11;
Condition2 = Mn = 3 and Wk > 2;
Condition3 = Mn = 11 and Wk <= 1;
If Condition1 or Condition2 or Condition3 then _Season = 1 else _Season = 0;
{
once cleardebug;
print(Date," ",Time," ",Mn," ",Dy," ",Wk," ",_Season );
}
//我是還沒接觸國外的期貨,不過應該星期日沒開盤,所以我用星期一來判斷是第幾個星期日 |
|