各位大大好
不知道為什麼這一串寫選股腳本都會逾時
能否幫忙看看哪邊有問題
謝謝
settotalBar(240);
input: d1(19,"幾天內創高"),
d2(1,"幾天內未再創高"),
wv(1000,"週均量");
var:v1(0),v2(0);
//v1 過去一年還原最高價的那一根kbar距離
v1 = nthHighestbar(1,getfield("h","ad"),240);
// 條件一: 首高要發生離現在比較近,次高距離今天比較遠(敘述次高創年高後,再發生首高突破)
condition1 = v1<d1 and v1>d2;
// 條件二: 周均量及月均量要大於2000張
condition2 = average(getfield("v","d"),5)>=wv;
// 條件三: 創高那根必須是長紅k
condition3 = close[v1] > open[v1]*1.03;
if condition1 and condition2 and condition3 then
begin
ret=1;
outputfield1(v1,"第一高距離bar");
outputfield(4,date[v1],"近一次創高日");
outputfield(5,close[v1],"新高收");
end;
1 評論