小幫手,想寫出安可(3615) 9/6到9/21這種型態的選股,上下給點範圍容忍度,但選不出來股票不知道如何修正比較好?
input:Len(30,"盤整的天數");
input:ratio(2,"紅K頂部區間幅度(%)");
input:ratio1(2, "紅K底部區間幅度(%)");
var:_hbar(0); //不含今日近期最高點相對位置
var:h1(0),L1(0);
_hbar=fastHighestBar(C[1],Len)+1;
h1=nthhighest(1,high[1],Len); //找出區間最高點
l1=nthlowest(1,low[1],Len); //找出區間最低點
condition1 = C >= O*1.05;
condition2 = C >= C[_hbar]*0.85;
condition3 = (h1-H[_hbar])/H[_hbar] <= ratio/100; //區間最高點與第一根紅K最高差距小於N%
condition4 = (L[_hbar]-l1)/L[_hbar] <= ratio1/100; //區間最低點與第一根紅K最低差距小於N%
condition5 = (H[_hbar]-C[_hbar])/C[_hbar+1] <= 0.01; //上影線部分小於1%
condition6 = (C[_hbar]-L[_hbar])/C[_hbar+1] <= 0.01; //下影線部分小於1%
if condition1 and condition2 and condition3 and condition4 and condition5 and condition6 then ret = 1;
1 評論