SetBackBar(300);
Vars:
i(0),
today(0),
day1(0), day2(0), // 前兩個交易日
maxVol(0), prevOpen(0),
isComputed(false), // 是否已經計算過
currDate(0), barCount(0);
// 取得今天日期
today = GetField("Date");
// 每根 K 棒進場都判斷
currDate = GetField("Date");
if currDate <> today[1] then begin
// 新的一天,重置旗標與 count
isComputed = false;
barCount = 0;
end;
// barCount 計算到第 1 根就觸發計算
barCount = barCount + 1;
if barCount = 1 and not isComputed then begin
// 1) 找出昨天與前天
day1 = 0; day2 = 0;
for i = 1 to 300 begin
if GetField("Date")[i] < today then begin
if day1 = 0 then
day1 = GetField("Date")[i]
else if day2 = 0 and GetField("Date")[i] <> day1 then
day2 = GetField("Date")[i];
if day1 <> 0 and day2 <> 0 then break;
end;
end;
// 2) 對這兩天找最大量開盤價
maxVol = 0; prevOpen = 0;
for i = 1 to 300 begin
if GetField("Date")[i] = day1 or GetField("Date")[i] = day2 then begin
if GetField("Volume")[i] > maxVol then begin
maxVol = GetField("Volume")[i];
prevOpen = GetField("Open")[i];
end;
end;
end;
isComputed = true; // 標記已計算
end;
// 3) 畫線:只畫這次計算出的 prevOpen,不再更新
if prevOpen > 0 then
Plot1(prevOpen, "前兩日最大量開盤價");
我的問題如下
1.我想要主圖畫出前兩天大量15分K的開盤價,也想要能夠顯示在1分K跟5分K
2.我要的只是一條線,不要因為數字起伏就跳動
3.主圖放大縮小他的線會亂跑(如附圖)
4.我要怎麼讓他跳通知 價格碰到
2 評論