COCO研究院

 找回密碼
 註冊
搜索
查看: 27655|回復: 1

[範例程式碼] 請問如何寫有特定開市時段的10天頂/底?

[複製鏈接]
發表於 19-11-12 19:26 | 顯示全部樓層 |閱讀模式
各位師兄,小弟想寫香港期指的日線圖5天最高/位,然後放於5分鐘圖運用

TimeFrameSet(inDaily);

FiveDayH = HHV(High, 5);
FiveDayL = LLV(Low, 5);

TimeFrameRestore();

FiveDayH = TimeFrameExpand(FiveDayH, inDaily);
FiveDayL = TimeFrameExpand(FiveDayL, inDaily);

Plot(FiveDayH,"Five Days High",colorOrange,styleLine|styleThick);
Plot(FiveDayL,"Five Days Low",colorAqua,styleLine|styleThick);

如果只寫5天,小弟自己寫了這個以乎都可以,但香港期指開市時間由早上9:15至翌日凌晨3時,我想嘗試把時間放進去,卻寫不出來,請各位師點

//Tradingtimeset
tn1 = TimeNum();
startTime = 091400;
endTime = 270000;
Tradingtime = tn1 >= startTime AND tn1 <= endTime;

//5DaysHigh & Low
TimeFrameSet(inDaily);

DayTwo = Ref(Tradingtime, -1);
DayThree = Ref(Tradingtime,-2);
DayFour = Ref(Tradingtime,-3);
DayFive = Ref(Tradingtime,-4);
DaySix = Ref(Tradingtime,-5);

FiveDays = DayTwo AND DayThree AND DayFour AND DayFive;

FiveDayH = Ref(High, FiveDays);
FiveDayL = Ref(Low, FiveDays);

TimeFrameRestore();

FiveDayH = TimeFrameExpand(FiveDayH, inDaily);
FiveDayL = TimeFrameExpand(FiveDayL, inDaily);

Plot(FiveDayH,"Five Days High",colorOrange,styleLine|styleThick);
Plot(FiveDayL,"Five Days Low",colorAqua,styleLine|styleThick);


發表於 19-12-17 09:55 | 顯示全部樓層
endTime = 270000;
if (tn < 90000) tn += 240000;  // 加入這一行
Tradingtime = tn1 >= startTime AND tn1 <= endTime;
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-11-22 05:42

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 |