以下内容为程序代码:
1 input:stopnum(20,5,50,5);
2 runmode:0;
3 variable:stopprice=0;
4
5 if holding=0 then begin
6 stopprice:=low-stopnum*mindiff;
7 buy(1,1,limitr,close);
8 end;
9
10 if holding>0 then begin
11 if low-stopnum*mindiff>stopprice then
12 stopprice:=low-stopnum*mindiff;
13
14 if low<=stopprice then begin
15 sell(1,holding,limitr,stopprice),orderqueue;
16 buyshort(1,1,limitr,stopprice),orderqueue;
17 end;
18 end;
19
20 if holding<0 then begin
21 if high+stopnum*mindiff<stopprice then
22 stopprice:=high+stopnum*mindiff;
23
24 if high>=stopprice then begin
25 sellshort(1,holding,limitr,stopprice),orderqueue;
26 buy(1,1,limitr,stopprice),orderqueue;
27 end;
28 end;
29
[此贴子已经被作者于2010-11-1 17:12:16编辑过]