疑問
實驗 同時寫兩種條件,跟兩種條件分兩次跑,結果沒有完全對上。
(單跑都有加then)
兩種條件如下:
輸出如下: 右邊是兩種寫在一起,少了6117/6415/8096
付上完整腳本:
input: HH(8,"N天前突破"); input: n(10,"Search天數"); input: v0(50,"量超過均量趴數"); input: percent(4,"漲幅上限"); input:avg_3_line(0); //均線糾結開關 //距離n%以內 input:main_force(0); //主力買超次數開關 input:today_include(1); //包含金日達成條件也抓 var: hasCrossOver(false); settotalBar(n); var: BarCount(0); //===================================================== Value11 = average(close, 5); Value22 = average(close, 10); Value33 = average(close, 20); value55 = MaxList(Value11, Value22, Value33); //均線 取最大 value66 = MaxList2(Value11, Value22, Value33); //均線 第二大 value77 = MinList(Value11, Value22, Value33); value88 = MinList2(Value11, Value22, Value33); //===================================================== //突破 站上均線的條件 if (close > highest(h[1],HH) and hasCrossOver=false and ( (Volume > Average(Volume[1], 5) * 1.9) or (Volume > Volume[1] * 1.9) ) and close>close[1]*1.01) or (((close[1] < value11[1]) or (close[1] < value22[1]) or (close[1] < value33[1]) and ((close > value11) and (close > value22) and (close > value33) )) and ( (Volume > Average(Volume[1], 5) * 1.9) or (Volume > Volume[1] * 1.9) ) and hasCrossOver=false and close>close[1]*1.02) then begin hasCrossOver=true; BarCount=currentBar; value111 = close; //儲存突破k棒的收盤價 end; if islastBar then if hasCrossOver=true then begin // //===================================================== //達成站上均線條件後,未漲超過n%以上。 //----------------------------------------------------- value44=rateOfChange(c,n-BarCount+1); condition3=value44<percent; //condition4=countIf( (high/value111) > 1.06 ,n-BarCount+1 ) <1; //突破到現在 最高價不能 曾超過6% //似乎不能這樣使用 //===================================================== //===================================================== //希望該股 非牛皮股,設定曾經單日漲幅 //----------------------------------------------------- condition7= countif(close/close[1] > 1.039, 90) > 0; //過去三個月 曾經單日漲幅4%以上 //===================================================== If today_include >0 then Begin condition6 = true; End Else Begin condition6 = BarCount <n; //剛突破不抓 ,若突破根search日同一天,BarCount會=n End; condition6 = BarCount <n; //剛突破不抓 ,若突破根search日同一天,BarCount會=n //===================================================== if condition3 and condition6 and condition7 then ret=1; outputField1(date[n-BarCount],"突破or站上日期"); //outputField2(value1,"突破至今的主力買賣超張數"); //outputField3(value2,"突破至今的主力買超天數"); //outputField4(value3,"突破至今的主力賣超天數 //outputField12(countIf( (high/value111) > 1.06 ,n-BarCount+1 ),"最高價,超過突破收盤價6%次數"); outputField6(n-BarCount+1,"n-BarCount+1"); outputField7(BarCount,"BarCount"); outputField5(value44,"突破至今的漲跌幅"); end;

8 評論