想請教為何以下腳本沒辦法回測 , 是因為條件太複雜嗎
value1 = 5 ; //漲幅進場% value2 = 6 ; //獲利目標% value3 = 6 ; //停損點 value4 = highest(high,20); //20天高 value5 = lowest(low,60); //60天低 value6 = 30 ; //60天漲幅條件 value7 = 20 ; //股價回測不得低於條件 value8 = average(close,5); //5ma value9 = average(close,10); //10ma value10 = average(close,20); //20ma value11 = average(close,60); //60ma vars: intrabarpersist highx(0); //紀錄高點 //進場 condition1 = value4 >= value5*(1+value6*0.01) ; //60天漲幅>=30% condition2 = close >= value4*(1-value7*0.01) ; //回檔不得超過20% condition3 = close >= close[1]*(1+value1*0.01) ; //漲幅進場 condition4 = close <= value8*1.1 ; //不得乖離5ma 大於10% condition5 = close >= value9 and close >= value10 and close >= value11 ; //大於等於 10 / 20 / 60 ma if filled=0 and condition1 and condition2 and condition3 and condition4 and condition5 then begin setposition(1, label:="in'"); highx = 0 ; end; if filled = 1 and close < filledavgPrice*(1-value3*0.01) then setposition(0, label:="母單停損'") ; if filled = 1 and close > filledavgPrice*1.03 then setposition(3, label:="加碼'") ; if filled = 3 then begin if close > highx then highx = close ; if highx >= filledavgPrice*(1+value2*0.01) and close < highx*0.94 then setposition(0, label:="停利") ; end;
4 評論