共5 条记录, 每页显示 10 条, 页签:
[1]
1楼
z7c9 发表于:2013/11/17 18:08:15
以下内容为程序代码:
1 runmode:0;
2
3 variable:currentholding=0;
4
5 holding1:=stkindi(stklabel,'f1a.持仓',0,dataperiod,0);
6 holding2:=stkindi(stklabel,'f2a.持仓',0,dataperiod,0);
7
8 targetholding:=holding1+holding2;
9
10 if targetholding=0 then begin
11 if currentholding>0 then
12 sell(1,currentholding,limitr,close);
13
14 if currentholding<0 then
15 sellshort(1,-currentholding,limitr,close);
16 end
17
18 if targetholding>0 then begin
19 if currentholding=0 then
20 buy(1,targetholding,limitr,close);
21
22 if currentholding>0 then begin
23 if targetholding>currentholding then
24 buy(1,targetholding-currentholding,limitr,close);
25
26 if targetholding<currentholding then
27 sell(1,currentholding-targetholding,limitr,close);
28 end
29
30 if currentholding<0 then begin
31 sellshort(1,-currentholding,limitr,close);
32 buy(1,targetholding,limitr,close);
33 end
34 end
35
36 if targetholding<0 then begin
37 if currentholding=0 then
38 buyshort(1,-targetholding,limitr,close);
39
40 if currentholding>0 then begin
41 sell(1,currentholding,limitr,close);
42 buyshort(1,-targetholding,limitr,close);
43 end
44
45 if currentholding<0 then begin
46 if targetholding>currentholding then
47 sellshort(1,targetholding-currentholding,limitr,close);
48
49 if targetholding<currentholding then
50 buyshort(1,currentholding-targetholding,limitr,close);
51 end
52 end
53
54 currentholding:=targetholding;
55
56 仓位:holding,noaxis,linethick0;
57 收益:asset-500000,noaxis,colormagenta,linethick2;
[此贴子已经被作者于2013/11/17 18:33:53编辑过]
2楼
z7c9 发表于:2013/11/21 0:07:37
runmode:0;
holding1:=stkindi(stklabel,'f1a.持仓',0,dataperiod,0);
holding2:=stkindi(stklabel,'f2a.持仓',0,dataperiod,0);
targetholding:=holding1+holding2;
if holding<> targetholding then begin
if holding=0 then begin
if targetholding>0 then
buy(1,targetholding,limitr,close);
if targetholding<0 then
buyshort(1,-targetholding,limitr,close);
end
if holding>0 then begin
if targetholding=0 then
sell(1,holding,limitr,close);
if targetholding>0 then begin
if targetholding>holding then
buy(1,targetholding-holding,limitr,close);
if targetholding<holding then
sell(1,holding-targetholding,limitr,close);
end
if targetholding<0 then begin
sell(1,holding,limitr,close);
buyshort(1,targetholding,limitr,close);
end
end
if holding<0 then begin
if targetholding=0 then
sellshort(1,holding,limitr,close);
if targetholding>0 then begin
sellshort(1,holding,limitr,close);
buy(1,targetholding,limitr,close);
end
if targetholding<0 then begin
if targetholding>holding then
sellshort(1,targetholding-holding,limitr,close);
if targetholding<holding then
buyshort(1,holding-targetholding,limitr,close);
end
end
end
3楼
z7c9 发表于:2013/11/21 0:07:51
以下内容为程序代码:
1 runmode:0;
2
3 holding1:=stkindi(stklabel,'f1a.持仓',0,dataperiod,0);
4 holding2:=stkindi(stklabel,'f2a.持仓',0,dataperiod,0);
5
6 targetholding:=holding1+holding2;
7
8 if holding<> targetholding then begin
9 if holding=0 then begin
10 if targetholding>0 then
11 buy(1,targetholding,limitr,close);
12
13 if targetholding<0 then
14 buyshort(1,-targetholding,limitr,close);
15 end
16
17 if holding>0 then begin
18 if targetholding=0 then
19 sell(1,holding,limitr,close);
20
21 if targetholding>0 then begin
22 if targetholding>holding then
23 buy(1,targetholding-holding,limitr,close);
24
25 if targetholding<holding then
26 sell(1,holding-targetholding,limitr,close);
27 end
28
29 if targetholding<0 then begin
30 sell(1,holding,limitr,close);
31 buyshort(1,targetholding,limitr,close);
32 end
33 end
34
35 if holding<0 then begin
36 if targetholding=0 then
37 sellshort(1,holding,limitr,close);
38
39 if targetholding>0 then begin
40 sellshort(1,holding,limitr,close);
41 buy(1,targetholding,limitr,close);
42 end
43
44 if targetholding<0 then begin
45 if targetholding>holding then
46 sellshort(1,targetholding-holding,limitr,close);
47
48 if targetholding<holding then
49 buyshort(1,holding-targetholding,limitr,close);
50 end
51 end
52 end
4楼
z7c9 发表于:2013/11/22 22:19:59
runmode:0;
variable:currentholding=0;
holding1:=stkindi(stklabel,'f1a.持仓',0,dataperiod,0);
holding2:=stkindi(stklabel,'f2a.持仓',0,dataperiod,0);
targetholding:=holding1+holding2;
if targetholding=0 then begin
if currentholding>0 then
sell(1,currentholding,limitr,close);
if currentholding<0 then
sellshort(1,-currentholding,limitr,close);
end
if targetholding>0 then begin
if currentholding=0 then
buy(1,targetholding,limitr,close);
if currentholding>0 then begin
if targetholding>currentholding then
buy(1,targetholding-currentholding,limitr,close);
if targetholding<currentholding then
sell(1,currentholding-targetholding,limitr,close);
end
if currentholding<0 then begin
sellshort(1,-currentholding,limitr,close);
buy(1,targetholding,limitr,close);
end
end
if targetholding<0 then begin
if currentholding=0 then
buyshort(1,-targetholding,limitr,close);
if currentholding>0 then begin
sell(1,currentholding,limitr,close);
buyshort(1,-targetholding,limitr,close);
end
if currentholding<0 then begin
if targetholding>currentholding then
sellshort(1,targetholding-currentholding,limitr,close);
if targetholding<currentholding then
buyshort(1,currentholding-targetholding,limitr,close);
end
end
currentholding:=targetholding;
仓位:holding,noaxis,linethick0;
收益:asset-500000,noaxis,colormagenta,linethick2;
5楼
sdrzhq 发表于:2014/1/9 19:36:56
共5 条记录, 每页显示 10 条, 页签:
[1]