VARIABLE
:nlow=
0
,mhigh=
0
;
Input
:snum(
1
,
1
,
100
,
1
);
h20:=
ref
(
hhv
(
h
,
20
),
1
);
l20:
ref
(
llv
(
l
,
20
),
1
);
h2:=
ref
(
hhv
(
h
,
2
),
1
);
l2:=
ref
(
llv
(
l
,
2
),
1
);
con1:=
BARSLAST
(
h
>h20)<=
3
and
low
<l2;
if
con1
then
nlow:=
low
;
con2:=
barslast
(
low
<l20)<=
3
and
high
>h2;
if
con2
then
mhigh:=
high
;
BuyCond:=
barslast
(con1)<=
3
and
high
>h20;
SellCond1:=
low
<=nlow;
SellCond2:
high
-
enterprice
>
2
*
abs
(
enterprice
-nlow);
BuyshortCond:=
barslast
(con2)<=
3
and
l
<l20;
SellshortCond1:=
high
>=mhigh;
SellshortCond2:
enterprice
-
low
>=
2
*
abs
(mhigh-
enterprice
);
if
SellCond1
then
多损:
Sell
(
holding
>
0
,snum,
market
);
if
SellCond2
then
多盈:
Sell
(
holding
>
0
,snum,
market
);
if
SellshortCond1
then
空损:
sellshort
(
holding
<
0
,snum,
market
);
if
SellshortCond2
then
空盈:
sellshort
(
holding
<
0
,snum,
market
);
if
BuyshortCond
then
buyshort
(
holding
=
0
,snum,
market
);
if
BuyCond
then
Buy
(
holding
=
0
,snum,
market
);