globalvariable
:abb=
0
;
variable
:hold1=
0
;
ma1:=
ma
(
c
,
10
);
ma2:=
ma
(
c
,
20
);
if
hold1>
0
and
ma1<ma2
then
hold1:=
0
;
if
hold1<
0
and
ma1>ma2
then
hold1:=
0
;
if
hold1=
0
and
ma1>ma2
then
hold1:=
1
;
if
hold1=
0
and
ma1<ma2
then
hold1:=-
1
;
zongcc:=
ref
(hold1,
1
);
if
not
(
islastbar
)
or
workmode
<>
1
then
exit
;
dnsj:=
currenttime
;
tm:=
mod
(dnsj,
100
);
flow:=
2
;
daima:=
'IF'
;
ac:=
'10002351'
;
pinzhong:=daima&
numtostrex
(newcang,
0
,
2
);
laststk:=daima&
numtostrex
(oldcang,
0
,
2
);
xdtm:=
30
;
if
abb=
2
and
tm>=xdtm-
3
and
tm<xdtm
then
begin
abb:=
0
;
tcancelex
(
1
,
0
,ac,pinzhong);
tcancelex
(
1
,
0
,ac,laststk);
end
if
abb=
0
and
tm>=xdtm
and
tm<xdtm+
10
then
begin
huadian:=
1
*
mindiff
;
orderbuy:=
dynainfo2
(
20
,pinzhong);
ordersell:=
dynainfo2
(
21
,pinzhong);
lastorderbuy:=
dynainfo2
(
20
,laststk);
lastordersell:=
dynainfo2
(
21
,laststk);
lastbuyhold:=
tbuyholdingex
(ac,laststk,
1
);
lastsellhold:=
tsellholdingex
(ac,laststk,
1
);
buyhold0:=
tbuyholdingex
(ac,pinzhong,
0
);
sellhold0:=
tsellholdingex
(ac,pinzhong,
0
);
buyhold:=
tbuyholdingex
(ac,pinzhong,
1
);
sellhold:=
tsellholdingex
(ac,pinzhong,
1
);
dingdan0:=zongcc-(buyhold-sellhold)-(lastbuyhold-lastsellhold);
dingdan:=
sgn
(dingdan0)*
min
(flow,
abs
(dingdan0));
if
dingdan>
0.5
then
begin
pc1:=
min
(dingdan,lastsellhold);
pc2:=
if
(sellhold0>
0.5
,
0
,
min
(dingdan-pc1,sellhold));
kc:=dingdan-pc1-pc2;
if
pc1>
0.5
then
begin
if
lastorderbuy>
1
and
lastordersell>
1
then
tsellshort
(
1
,pc1,
lmt
,lastorderbuy+huadian,
0
,ac,laststk),
allowrepeat
;
end
if
orderbuy>
1
and
ordersell>
1
then
begin
if
pc2>
0.5
then
tsellshort
(
1
,pc2,
lmt
,orderbuy+huadian,
0
,ac,pinzhong),
allowrepeat
;
if
kc>
0.5
then
tbuy
(
1
,kc,
lmt
,orderbuy+huadian,
0
,ac,pinzhong),
allowrepeat
;
end
end
if
dingdan<-
0.5
then
begin
pc1:=
min
(-dingdan,lastbuyhold);
pc2:=
if
(buyhold0>
0.5
,
0
,
min
(-dingdan-pc1,buyhold));
kc:=-dingdan-pc1-pc2;
if
pc1>
0.5
then
begin
if
lastorderbuy>
1
and
lastordersell>
1
then
tsell
(
1
,pc1,
lmt
,lastordersell-huadian,
0
,ac,laststk),
allowrepeat
;
end
if
orderbuy>
1
and
ordersell>
1
then
begin
if
pc2>
0.5
then
tsell
(
1
,pc2,
lmt
,ordersell-huadian,
0
,ac,pinzhong),
allowrepeat
;
if
kc>
0.5
then
tbuyshort
(
1
,kc,
lmt
,ordersell-huadian,
0
,ac,pinzhong),
allowrepeat
;
end
end
if
dingdan=
0
and
time
>=
143000
and
(lastbuyhold>
0.5
or
lastsellhold>
0.5
)
then
begin
lastdingdan0:=
0
-(lastbuyhold-lastsellhold);
lastdingdan:=
sgn
(lastdingdan0)*
min
(flow,
abs
(lastdingdan0));
if
lastdingdan<-
0.5
then
begin
pc2:=-lastdingdan;
if
lastorderbuy>
1
and
lastordersell>
1
then
tsell
(
1
,pc2,
lmt
,lastordersell-huadian,
0
,ac,laststk),
allowrepeat
;
if
orderbuy>
1
and
ordersell>
1
then
tbuy
(
1
,pc2,
lmt
,orderbuy+huadian,
0
,ac,pinzhong),
allowrepeat
;
end
if
lastdingdan>
0.5
then
begin
pc2:=lastdingdan;
if
lastorderbuy>
1
and
lastordersell>
1
then
tsellshort
(
1
,pc2,
lmt
,lastordersell+huadian,
0
,ac,laststk),
allowrepeat
;
if
orderbuy>
1
and
ordersell>
1
then
tbuyshort
(
1
,pc2,
lmt
,orderbuy-huadian,
0
,ac,pinzhong),
allowrepeat
;
end
if
lastdingdan=
0
and
lastbuyhold>
0.5
then
begin
pc1:=
min
(flow,lastbuyhold);
chaju:=lastordersell-lastorderbuy;
xx:=
if
(chaju>
0.5
,
1
,
0
);
if
lastorderbuy>
1
and
lastordersell>
1
then
begin
tsellshort
(
1
,pc1,
lmt
,lastorderbuy+xx*
0.2
,
0
,ac,laststk),
allowrepeat
;
tsell
(
1
,pc1,
lmt
,lastordersell-xx*
0.2
,
0
,ac,laststk),
allowrepeat
;
end
end
end
abb:=
2
;
end