INPUT
:N1(
5
,
1
,
200
,
1
),N2(
10
,
1
,
200
,
1
),N3(
20
,
1
,
200
,
1
),ss(
1
,
1
,
200
,
1
),N(
20
,
1
,
300
,
1
),M(
40
,
1
,
300
,
1
);
ma5:
ma
(
c
,N1);
ma10:
ma
(
c
,N2);
ma20:
ma
(
c
,N3);
多止损:
l
<
ref
(
l
,
1
)-
1
*
mindiff
;
空止损:
h
>
ref
(
h
,
1
)+
1
*
mindiff
;
多止盈:
TTYPE
(
1
)=
1
and
c
-
TORDERPRICE
(
1
,
1
) >=N*
MINDIFF
and
TORDERPRICE
(
1
,
1
)>
0
;
空止盈:
TTYPE
(
1
)=
3
and
TORDERPRICE
(
3
,
1
)-
c
>=N*
MINDIFF
and
TORDERPRICE
(
1
,
1
)>
0
;
tsell
(多止损
and
tbuyholdingex
(
''
,
''
,
1
)>
0
,
tbuyholdingex
(
''
,
''
,
1
),
mkt
);
tsellshort
(空止损
and
tsellholdingex
(
''
,
''
,
1
)>
0
,
tsellholdingex
(
''
,
''
,
1
),
mkt
);
tsell
(多止盈
and
tbuyholdingex
(
''
,
''
,
1
)>
0
,
tbuyholdingex
(
''
,
''
,
1
),
mkt
);
tsellshort
(空止盈
and
tsellholdingex
(
''
,
''
,
1
)>
0
,
tsellholdingex
(
''
,
''
,
1
),
mkt
);
cond1:=
c
>ma20
and
cross
(ma5,ma10)
AND
(
h
-
l
)<=M*
MINDIFF
and
c
>
max
(
ref
(
c
,
1
),
ref
(
o
,
1
));
cond2:=
c
<ma20
and
cross
(ma10,ma5)
AND
(
h
-
l
)<=M*
MINDIFF
and
c
<
min
(
ref
(
c
,
1
),
ref
(
o
,
1
));
kd:
ref
(cond1,
1
)
and
c
>
ref
(
h
,
1
);
kk:
ref
(cond2,
1
)
and
c
<
ref
(
l
,
1
);
t:
time0
-
timetot0
(
dynainfo
(
207
));
tbuy
(kd,ss,
lmt
,
ref
(
h
,
1
)+
1
*
mindiff
);
tbuyshort
(kk,ss,
lmt
,
ref
(
l
,
1
)-
1
*
mindiff
);
if
c
<
ref
(
h
,
1
)
and
TISPRVREMAIN
(
1
)
and
t<=
2
then
TCANCELEX
(
1
,
1
,
''
,
STKLABEL
);
if
c
>
ref
(
l
,
1
)
and
TISPRVREMAIN
(
3
)
and
t<=
2
then
TCANCELEX
(
1
,
3
,
''
,
STKLABEL
);
if
TENTERBARS
(
1
)=
1
and
TISPRVREMAIN
(
1
)
then
TCANCELEX
(
1
,
1
,
''
,
STKLABEL
);
if
TENTERBARS
(
1
)=
1
and
TISPRVREMAIN
(
3
)
then
TCANCELEX
(
1
,
3
,
''
,
STKLABEL
);