小編您好,
我有以下警示程式片段
// 大盤漲跌家數穿越
var: UpUps (0), lastUpUps (0);
var: DwDws (0), lastDwDws (0);
if time = TSE_OPEN_TIME then
begin
UpUps = GetSymbolField("TSE.TW", "上漲家數", "D");
DwDws = GetSymbolField("TSE.TW", "下跌家數", "D");
lastUpUps = UpUps;
lastDwDws = DwDws;
end
else
begin
lastUpUps = UpUps;
lastDwDws = DwDws;
UpUps = GetSymbolField("TSE.TW", "上漲家數", "D");
DwDws = GetSymbolField("TSE.TW", "下跌家數", "D");
end;
PRINT (NumToStr (time, 0), "|", NumToStr (UpUps, 0), "|", NumToStr (DwDws, 0), "|", NumToStr (lastUpUps, 0), "|", NumToStr (lastDwDws, 0));
if UpUps > DwDws and lastUpUps < lastDwDws then
begin
AlertMsg = AlertMsg + " | ↑ 上漲家數穿越";
ret = True;
retmsg = AlertMsg;
end;
if UpUps < DwDws and lastUpUps > lastDwDws then
begin
AlertMsg = AlertMsg + " | ↓ 下跌家數穿越";
ret = True;
retmsg = AlertMsg;
end;
因為盤中應該出警示而未出,因此特意加了 PRINT去觀察,以下為PRINT的結果
100500 | 544 | 445 | 542 | 443
100600 | 543 | 444 | 544 | 445 <--- 策略啟動
100700 | 543 | 444 | 543 | 444
100800 | 543 | 444 | 543 | 444
100900 | 543 | 444 | 543 | 444
發現啟動後,似乎即時資料抓取一直都未更新,可否幫忙確認,謝謝。
9 評論