INPUT
:DIF(
5
,
1
,
1000
,
1
),SS(
1
,
1
,
1000
,
1
);
VARIABLE
:levelb:=-
1
,levels:=-
1
;
L1:
CALLSTOCK
(
''
,
vtLOW
,
6
,-
1
);
H1:
CALLSTOCK
(
''
,
vtHIGH
,
6
,-
1
);
if
TODAYBAR
=
1
then
begin
levelb:=-
1
;
levels:=-
1
;
end
level1:
FLOOR
((H1-
c
)/DIF);
level2:
FLOOR
((
c
-l1)/DIF);
if
levelb=-
1
then
levelb:=
max
(
1
,level1);
if
levels=-
1
then
levels:=
max
(
1
,level2);
upprice:=H1-(
max
(levelb,level1))*DIF;
dnprice:=L1+(
max
(levels,level2))*DIF;
买:=
c
<=upprice
and
levelb>=
0
and
level2>
0
;
卖:=
c
>=dnprice
and
HOLDING
>
0
and
levels>=
0
;
if
卖
then
begin
sell
(
1
,SS,
market
);
levels:=level2+
1
;
end
if
买
then
begin
buy
(
1
,SS,
market
);
levelb:=level1+
1
;
end
if
time
=
CLOSETIME
(
0
)
then
begin
收盘平仓:
sell
(
1
,
holding
,
market
);
END