if BarFreq <> "1" then begin
return;
raiseRunTimeError("頻率錯誤");
end;
//===========================================進場===========================================
input: mintime(090100,"最早進場時間"),maxtime(091500,"最晚進場時間");
if {GetField("買賣現沖", "D")} GetSymbolInfo("買賣現沖") = true //確定該個股可以當沖
and currenttime>= mintime and currenttime< maxtime then begin //確定進場時間(9:01-9:15)
input:minprice(10,"最低價格"), maxprice(100,"最高價格");
input:minV(5000,"昨日成交量");
value1 = GetBarOffset(CurrentDate,090000); //抓當天第一根1分K棒位子
if Date <> CurrentDate then return;
condition11 = close>= minprice and close <= maxprice and getfield("volume","D")[1]>minV; //確定股價跟昨日成交量
CONdition12 = c[value1] > o[value1]; //第一根1分K為紅K
if condition11 and condition12 then begin
input: Capital(100,"每檔資金(萬)");
var: OrderQuantity(0);
condition21 = value1 < 5 and c[1] > l[value1] and c[1] < h[value1] and v[1] = lowest(v, value1) and c>h[value1] and v<v[value1];
{距離第一根K棒不超過5根,且前一根K棒位於第一根K棒的K棒範圍內,且為當日最小量(抓凹洞量),當根K棒過高,且不爆量}
condition22 = (value1 = 1 and c>h[value1] and v<v[value1]); {第2根K棒就過高不爆量}
condition20 = lowest(l, value1-1) > low[value1] //第2根以後的K棒低點都不低於第一根的低點
and low[value1] > closeD(1)*1.01 //跳空開高,且最低點不填補開高的缺口
and (c-closeD(1))/closeD(1)*100 < 7 //當日漲幅小於7趴
and (condition21 or condition22);
if condition20[1]
and Position = 0 and filled=0 then begin
OrderQuantity=round(Capital*10000/Close/1000,0);
SetPosition(OrderQuantity,Market);
end;
end;
end;
//===========================================出場===========================================
input: PT(3,"停利%"), SL(1, "停損%") ;
if (position>0 and filled>0 and time>=filledRecordDate(FilledRecordCount) )
and (
{( SL > 0 and Close <= FilledAvgPrice*(1-(0.01*SL)) )
or ( PT > 0 and Close >= FilledAvgPrice*(1+(0.01*PT)) )
or }c[1] < average(c,5)[1] or c < l[value1] or c<closeD(1) or c = GetField("漲停價", "D") or c < GetField("均價") or time > 130000
{收盤破五均} {跌破第1根K棒低點} {破平盤} {碰漲停} {破均價線} {時間到13:00}
)
then SetPosition(0);
下面這邊是我突然想到的當沖想法,但是不知道是不是條件太多,反而導致選不出股票,不知道這種時候應該怎麼去做試驗或除錯,希望能在這邊獲得一些方法或意見~
6 評論