以下的策略同時寫在警示跟選股的策略,但回測的結果卻不同,是因為什麼原因呢?
input: shortlength(3); setinputname(1,"短期均線期數");
input: midlength(5); setinputname(2,"中期均線期數");
input: Longlength(8); setinputname(3,"長期均線期數");
input: Percent(2); setinputname(4,"均線糾結區間%");
input: Volpercent(25); setinputname(5,"放量幅度%");//帶量突破的量是超過最長期的均量多少%
variable: shortaverage(0);
variable: midaverage(0);
variable: Longaverage(0);
condition1=false;
condition2=false;
condition3=false;
//成交量過小過濾
input:Length(5);
input:VolumeLimit(500);
SetInputName(1, "均量天期");
SetInputName(2, "最小均量");
SetTotalBar(3);
Value4 = Average(volume, Length);
if Value4 > VolumeLimit then condition1=true;
//收盤價高於昨天收盤價
if close > close[1] then condition2=true;
//突破358糾結均線
settotalbar(8);
setbarback(maxlist(shortlength,midlength,Longlength));
if volume > average(volume,Longlength) * (1 + volpercent * 0.01) then
begin
shortaverage = average(close,shortlength);
midaverage = average(close,midlength);
Longaverage = average(close,Longlength);
if Close crosses over maxlist(shortaverage,midaverage,Longaverage) then
begin
value1= absvalue(shortaverage -midaverage);
value2= absvalue(midaverage -Longaverage);
value3= absvalue(Longaverage -shortaverage);
if maxlist(value1,value2,value3)*100 < Percent*Close
and condition1 and condition2
then ret=1;
end;
end;
2 評論