結算日前一天的下午
我指香港指數期貨:假設下一個星期一是假期 (及假期已可在 quotemanager 查到), 星期二是期貨結算日, 目標是在結算日前一交易日(即星期五)下午四時把所有合約平倉
這需要一 function 能決定輸入日期是否假期, multicharts 能否做到?
也許你可以試試 IsWorkDay() 寫了這段程式:
if isworkday(stringtodate("23/09/2017")) then
messagelog("isworkday(23/09/2017) is true");
if isworkday(stringtodate("24/09/2017")) then
messagelog("isworkday(24/09/2017) is true");
if isworkday(stringtodate("25/09/2017")) then
messagelog("isworkday(25/09/2017) is true");
if isworkday(stringtodate("26/09/2017")) then
messagelog("isworkday(26/09/2017) is true");
if isworkday(stringtodate("27/09/2017")) then
messagelog("isworkday(27/09/2017) is true");
if isworkday(stringtodate("28/09/2017")) then
messagelog("isworkday(28/09/2017) is true");
if isworkday(stringtodate("29/09/2017")) then
messagelog("isworkday(29/09/2017) is true");
if isworkday(stringtodate("30/09/2017")) then
messagelog("isworkday(30/09/2017) is true");
if isworkday(stringtodate("01/10/2017")) then
messagelog("isworkday(01/10/2017) is true");
if isworkday(stringtodate("02/10/2017")) then
messagelog("isworkday(02/10/2017) is true");
if isworkday(stringtodate("03/10/2017")) then
messagelog("isworkday(03/10/2017) is true");
if isworkday(stringtodate("04/10/2017")) then
messagelog("isworkday(04/10/2017) is true");
if isworkday(stringtodate("05/10/2017")) then
messagelog("isworkday(05/10/2017) is true");
if isworkday(stringtodate("06/10/2017")) then
messagelog("isworkday(06/10/2017) is true");
if isworkday(stringtodate("07/10/2017")) then
messagelog("isworkday(07/10/2017) is true");
結果是 (我在香港, 是 default UK regional format):
isworkday(23/09/2017) is true
isworkday(24/09/2017) is true
isworkday(25/09/2017) is true
isworkday(28/09/2017) is true
isworkday(29/09/2017) is true
isworkday(30/09/2017) is true
isworkday(01/10/2017) is true
isworkday(02/10/2017) is true
isworkday(05/10/2017) is true
isworkday(06/10/2017) is true
isworkday(07/10/2017) is true
為何星期二, 三, 便是 false?
頁:
[1]