AbstractStrategy:
以下内容为程序代码:
1 runmode:0;
2
3 input:system(1,1,2,1);
4
5 if holding=0 then begin
6 buycond:=stkindi(stklabel,'ContractStrategy.buycond('+numtostr(system,0)+')',0,dataperiod),linethick0;
7 buyprice:=stkindi(stklabel,'ContractStrategy.buyprice('+numtostr(system,0)+')',0,dataperiod),linethick0;
8 buylots:=stkindi(stklabel,'ContractStrategy.buylots('+numtostr(system,0)+')',0,dataperiod),linethick0;
9
10 if buycond then
11 buy(1,buylots,limitr,buyprice);
12 end
13
14 if holding=0 then begin
15 buyshortcond:=stkindi(stklabel,'ContractStrategy.buyshortcond('+numtostr(system,0)+')',0,dataperiod);
16 buyshortprice:=stkindi(stklabel,'ContractStrategy.buyshortprice('+numtostr(system,0)+')',0,dataperiod);
17 buyshortlots:=stkindi(stklabel,'ContractStrategy.buyshortlots('+numtostr(system,0)+')',0,dataperiod);
18
19 if buyshortcond then
20 buyshort(1,buyshortlots,limitr,buyshortprice);
21 end
22
23 if holding>0 then begin
24 sellcond:=stkindi(stklabel,'ContractStrategy.sellcond('+numtostr(system,0)+')',0,dataperiod);
25 sellprice:=stkindi(stklabel,'ContractStrategy.sellprice('+numtostr(system,0)+')',0,dataperiod);
26 selllots:=stkindi(stklabel,'ContractStrategy.selllots('+numtostr(system,0)+')',0,dataperiod);
27
28 if sellcond then
29 sell(1,selllots,limitr,sellprice);
30 end
31
32 if holding<0 then begin
33 sellshortcond:=stkindi(stklabel,'ContractStrategy.sellshortcond('+numtostr(system,0)+')',0,dataperiod);
34 sellshortprice:=stkindi(stklabel,'ContractStrategy.sellshortprice('+numtostr(system,0)+')',0,dataperiod);
35 sellshortlots:=stkindi(stklabel,'ContractStrategy.sellshortlots('+numtostr(system,0)+')',0,dataperiod);
36
37 if sellshortcond then
38 sell(1,sellshortlots,limitr,sellshortprice);
39 end
ContractStrategy:
以下内容为程序代码:
1 runmode:0;
2
3 input:system(1,1,2,1);
4
5 buycond:if(system=1,1,if(system=2,0,0));
6 buyprice:if(system=1,close,if(system=2,open,0));
7 buylots:if(system=1,1,if(system=2,2,0));
8
9 buyshortcond:if(system=1,1,if(system=2,0,0));
10 buyshortprice:if(system=1,close,if(system=2,open,0));
11 buyshortlots:if(system=1,1,if(system=2,2,0));
12
13 sellcond:if(system=1,1,if(system=2,0,0));
14 sellprice:if(system=1,close,if(system=2,open,0));
15 selllots:if(system=1,1,if(system=2,2,0));
16
17 sellshortcond:if(system=1,1,if(system=2,0,0));
18 sellshortprice:if(system=1,close,if(system=2,open,0));
19 sellshortlots:if(system=1,1,if(system=2,2,0));
[此贴子已经被作者于2011-1-1 15:29:04编辑过]