ATR :=
MA
(
TR
,
5
);
MAC:
MA
(
C
,
5
);
if
(MAC>=
REF
(MAC,
1
),MAC,
drawnull
),
COLORRED
;
if
(MAC<=
REF
(MAC,
1
),MAC,
drawnull
),
COLORGREEN
;
MAH:MAC+ATR;
if
(MAH>=
REF
(MAH,
1
),MAH,
drawnull
),
COLORRED
;
if
(MAH<=
REF
(MAH,
1
),MAH,
drawnull
),
COLORGREEN
;
MAL:MAC-ATR;
if
(MAL>=
REF
(MAL,
1
),MAL,
drawnull
),
COLORRED
;
if
(MAL<=
REF
(MAL,
1
),MAL,
drawnull
),
COLORGREEN
;
DG:=
CLOSE
>=
LLV
(MAH,
5
)&&MAC>=
REF
(MAC,
1
);
KG:=
CLOSE
<=
HHV
(MAL,
5
)&&MAC<=
REF
(MAC,
1
);
DRAWTEXT
(
CROSS
(DG&&
C
>MAH,
0.5
)&&
COUNT
(
CROSS
(DG&&
C
>MAH,
0.5
),
BARSLAST
(
CROSS
(KG&&
C
<MAL,
0.5
)))=
1
,
HIGH
*
1.0001
,
'多'
),
COLORRED
;
DRAWTEXT
(
CROSS
(KG&&
C
<MAL,
0.5
)&&
COUNT
(
CROSS
(KG&&
C
<MAL,
0.5
),
BARSLAST
(
CROSS
(DG&&
C
>MAH,
0.5
)))=
1
,
LOW
*
0.9999
,
'空'
),
COLORGREEN
;
IF
CROSS
(DG&&
C
>MAH,
0.5
)
THEN
BEGIN
SELLSHORT
(
HOLDING
<
0
,
HOLDING
,
MARKET
);
BUY
(
HOLDING
=
0
,
1
,
MARKET
);
END
IF
CROSS
(KG&&
C
<MAL,
0.5
)
THEN
BEGIN
SELL
(
HOLDING
>
0
,
HOLDING
,
MARKET
);
BUYSHORT
(
HOLDING
=
0
,
1
,
MARKET
);
END