账号666666的策略:
以下内容为程序代码:
1 begintime:=currenttime>=091500 and currenttime<=145500;
2 endtime:=currenttime>=145930;
3
4 buycond:=begintime;
5 sellcond:=begintime;
6
7 if tbuyholdingex('666666',0,0)=0 then begin
8 if buycond then begin
9 buyprice:=close;
10 mycash:=taccount2(19,'666666');
11 lots:=intpart(mycash/(buyprice*multiplier*taccount(41)));
12 tbuy(1,lots,lmt,close,0,'666666',0);
13 end
14 end
15
16 if tsellholdingex('666666',0,0)=0 then begin
17 if sellcond then begin
18 sellprice:=close;
19 mycash:=taccount2(19,'666666');
20 lots:=intpart(mycash/(sellprice*multiplier*taccount(42)));
21 tbuyshort(1,lots,lmt,close,0,'666666',0);
22 end
23 end
24
25 if tbuyholdingex('666666',0,0)>0 then begin
26 if endtime then
27 tsell(1,tbuyholdingex('666666',0,0),lmt,close,'666666',0);
28 end
29
30 if tsellholdingex('666666',0,0)<0 then begin
31 if endtime then
32 tsellshort(1,tsellholdingex('666666',0,0),lmt,close,'666666',0);
33 end
账号888888的策略:
以下内容为程序代码:
1 begintime:=currenttime>=091500 and currenttime<=145500;
2 endtime:=currenttime>=145930;
3
4 buycond:=begintime;
5 sellcond:=begintime;
6
7 if tbuyholdingex('888888',0,0)=0 then begin
8 if buycond then begin
9 buyprice:=close;
10 mycash:=taccount2(19,'888888');
11 lots:=intpart(mycash/(buyprice*multiplier*taccount(41)));
12 tbuy(1,lots,lmt,close,0,'888888',0);
13 end
14 end
15
16 if tsellholdingex('888888',0,0)=0 then begin
17 if sellcond then begin
18 sellprice:=close;
19 mycash:=taccount2(19,'888888');
20 lots:=intpart(mycash/(sellprice*multiplier*taccount(42)));
21 tbuyshort(1,lots,lmt,close,0,'888888',0);
22 end
23 end
24
25 if tbuyholdingex('888888',0,0)>0 then begin
26 if endtime then
27 tsell(1,tbuyholdingex('888888',0,0),lmt,close,'888888',0);
28 end
29
30 if tsellholdingex('888888',0,0)<0 then begin
31 if endtime then
32 tsellshort(1,tsellholdingex('888888',0,0),lmt,close,'888888',0);
33 end
仅仅因为账号不同就需要写多个公式?这个不太合理吧。
[此贴子已经被作者于2010-12-28 12:09:48编辑过]
以下是引用董小球在2010-12-28 14:06:14的发言:
也可以用 条件2 or 条件2 then的形式嘛
你认为怎样最好?
那还是1个策略不是2个策略吧,总不能把所有的策略写在一个公式中吧。
总不能有多少个账号,就copy多少份代码吧?
就像一个策略可以应用在多个品种上,一个策略应该也可以应用在多个账号上才对。
[此贴子已经被作者于2010-12-28 17:32:22编辑过]