variable
:num:=
0
;
ma5:=
ma
(
close
,
5
);
ma20:=
ma
(
close
,
20
);
cond1:=ma5>ma20;
cond2:=ma5<ma20;
if
cond2
and
holding
>
0
then
begin
sell
(
1
,
1
,
market
);
num:=
0
;
end
if
cond2
and
holding
=
0
and
num<=
0
then
begin
buyshort
(
1
,
1
,
market
);
end
if
cond1
and
holding
<
0
then
begin
sellshort
(
1
,
1
,
market
);
num:=
0
;
end
if
cond1
and
holding
=
0
and
num>=
0
then
begin
buy
(
1
,
1
,
market
);
end
if
openprofitper
>=
1.70
and
holding
>
0
then
begin
多止盈:
sell
(
1
,
holding
,
market
);
num:=-
1
;
end
if
openprofitper
<-
0.50
and
holding
>
0
then
begin
多止损:
sell
(
1
,
holding
,
market
),FONTSZUP2;
num:=
0
;
end
if
openprofitper
>=
1.70
and
holding
<
0
then
begin
空止盈:
sellshort
(
1
,
holding
,
market
) ,FONTSZUP2;
num:=
1
;
end
if
openprofitper
<-
0.50
and
holding
<
0
then
begin
空止损:
sellshort
(
1
,
holding
,
market
);
num:=
0
;
end