
以下内容为程序代码:
1 runmode:0;
2
3 input:n(20,1,100,1);
4
5 ma1:=trimprice(ma(close,n));
6
7 ma2:=trimprice(ma1*1.01);
8 ma3:=trimprice(ma1*0.99);
9
10 if holding=0 then begin
11 if cross(close,ma2) then
12 buy(1,1,limitr,close);
13 end
14
15 if holding=0 then begin
16 if cross(ma3,close) then
17 buyshort(1,1,limitr,close);
18 end
19
20 if holding>0 then begin
21 if cross(ma1,close) then
22 sell(1,holding,limitr,close);
23 end
24
25 if holding<0 then begin
26 if cross(close,ma1) then
27 sellshort(1,holding,limitr,close);
28 end
29
30 资产:asset,noaxis,colormagenta;
31 次数:totaltrade,linethick0;
32 收益:(asset-40000)/40000,linethick0;
33 胜率:percentwin,linethick0;
34 出击:totaltrade/(count(date<>ref(date,1),0)+1),linethick0;
35 连亏:maxseqloss,linethick0;
36 连赢:maxseqwin,linethick0;
37
[此贴子已经被作者于2011-10-3 11:30:17编辑过]
这么简单的策略效果这么好吗?会不会有不成交的情况?