hi 小幫手
最近試著用迴圈寫條件觸發前15根內的最高價=今日最高價且K棒為30%的上影線, 但始終無法達成預期.
能否給建議是哪裡邏輯有謬誤?
謝謝
// 創新高後進入變色區
variable:KN(0);
IF DATE<>DATE[1] then begin
KN=0;
ENd;
KN=KN+1;
VALUE1=average(C,KN);
variable:ema3(0),sma10(0);
ema3=ema(close,3);
sma10=average(close,10);
condition1=ema3 cross Under value1;
condition2=ema3 cross Under sma10;
Value3=HighD(0);
var: barRange(0);
var: upperShadow(0);
var:i(0);
i=0;
for i=0 to 15 begin
if High[i]=Value3 then begin
barRange=High[i]-Low[i];
if barRange<>0 then
upperShadow=High[i]-MaxList(Open[i], Close[i])/barRange;
break;
end;
end;
if High[i]=Value3 and upperShadow>0.3 and High[i]<>getField("漲停價", "D") and trueAll(condition1[1]=false,5) and ema3 cross Under value1 then plot1(ema3,"進入變色區");
if High[i]=Value3 and upperShadow>0.3 and High[i]<>getField("漲停價", "D") and trueAll(condition2[1]=false,5) and ema3 cross Under sma10 then plot3(ema3,"將要進入變色區");
4 評論