想請問大神與小幫手
如果想顯示出,盤中1分K量大於開盤第一分鐘1分K量的1.5倍
並且第一分鐘K的成交值大於2000萬
然後只提醒一次即可
請問這樣怎麼寫比較好,感謝~
盤中1分K的量大於開盤第一分鐘K棒的量,顯示出警示
- 985
- 最後發表 stockLIFE 2024 十一月 20
stockLIFE
發文於
2024/08/14
虎科大許教授
發文於
2024/08/14
if barfreq<> "Min" or barinterval <> 1 then raiseRunTimeError("只支援1分K");
var: intraBarPersist myV(0);
var: intraBarPersist hasRet(false);
if date<>date[1] then
begin
myV=0;
hasRet=false;
end
else
begin
if hasRet=true then return;
if time=090100 then
begin
if GetField("成交金額(元)")[1]<20000000 then hasRet=true;
myV=v[1];
end;
if v>myV*1.5 and hasRet=false then
begin
Alert("爆量!");
hasRet=true;
end;
end;
stockLIFE
發文於
2024/08/15
謝謝許教授的回覆! 明天來試看看!
因為有觀察到 ,爆量通常會是股價的最高點,想說可以拿來試單空看看,感謝!
JIMMYONNET
發文於
2024/11/13
想請問大神與小幫手
同樣上面的條件【中1分K量大於開盤第一分鐘1分K量的1.5倍
並且第一分鐘K的成交值大於2000萬】
然後我如果要再加上這個條件,程式碼要怎麼寫呢?
這1分K的價格創下日內高點且漲幅大於3%
請問這樣怎麼寫比較好,感謝~
虎科大許教授
發文於
2024/11/13
if barfreq<> "Min" or barinterval <> 1 then raiseRunTimeError("只支援1分K");
var: intraBarPersist myV(0);
var: intraBarPersist hasRet(false);
if date<>date[1] then
begin
myV=0;
hasRet=false;
end
else
begin
if hasRet=true then return;
if time=090100 then
begin
if GetField("成交金額(元)")[1]<20000000 then hasRet=true;
myV=v[1];
end;
if v>myV*1.5 and h=highD(0) and GetQuote("漲跌幅")>3 and hasRet=false then
begin
Alert("爆量且創高!");
hasRet=true;
end;
end;
CMW
發文於
2024/11/13
最近在練習寫XQ回測,剛好遇到類似的問題。
我想要在上面的程式碼,加上這一個限制條件的話,如果時間超過上午十一點,就不要進場交易,應該要怎麼寫呢?
另外,在進行回測時,進場價格只能下期開盤價或是當期收盤價嗎??
我能夠設定進場價格是在低於當日最高價的1%的價格進場嗎?例如當日最高價是100,我想要設定回測的價位是在99這樣。
不知道下面這條件寫得對不對?
先感謝大神跟小幫手。
if barfreq <> "Min" or barinterval <> 1 then raiseRunTimeError("只支援1分K");
var: intraBarPersist myV(0);
var: intraBarPersist hasRet(false);
if date <> date[1] then
begin
myV = 0;
hasRet = false;
end
else
begin
if hasRet = true then return;
if time = 090100 then
begin
if GetField("成交金額(元)")[1] < 20000000 then hasRet = true;
myV = v[1];
end;
// 加入進場時間條件:只在09:00:00至10:59:59之間
if time >= 090000 and time <= 105959
and v > myV * 1.5
and h = highD(0)
and GetQuote("漲跌幅") > 3
and hasRet = false then
begin
Alert("爆量且創高!");
Short(1, HIGHD(0) * 0.99); // 在符合條件的情況下建立空頭頭寸
hasRet = true; // 避免重複觸發
end;
end;
虎科大許教授
發文於
2024/11/13
(1)在進行回測時,進場價格只能下期開盤價或是當期收盤價嗎??
回測的逐筆洗價是1分鐘最多洗價4次。進場價格看開高低收何者觸發。
(2)設定進場價格是在低於當日最高價的1%的價格進場嗎?例如當日最高價是100,我想要設定回測的價位是在99這樣。
可以。委託價用highD(0)*0.99。不過用這個委託價Short,很可能會以觸發價成交。
7 評論