variable
:nums:=
0
;
if
bpkcond
and
holding
<=
0
then
begin
sellshort
(
holding
<
0
,
0
,
thisclose
);
buy
(
holding
=
0
,lot,
thisclose
);
nums:=
1
;
end
if
spkcond
and
holding
>=
0
then
begin
sell
(
holding
>
0
,
0
,
thisclose
);
buyshort
(
holding
=
0
,lot,
thisclose
);
nums:=
1
;
end
多单回调:
holding
>
0
and
(底背离
or
cross
(ma1,
c
)
or
cross
(
0
,j))
and
enterbars
>
1
;
空单回调:
holding
<
0
and
(顶背离
or
cross
(
c
,ma1)
or
cross
(j,
100
))
and
enterbars
>
1
;
if
nums<
2
then
begin
回调加多:
buy
(多单回调,lot,
thisclose
);
nums:=
2
;
end
if
nums<
2
then
begin
回调加空:
sell
(空单回调,lot,
thisclose
);
nums:=
2
;
end
顶背离止盈卖
1
/
2
:
sell
(
holding
>
0
and
顶背离 ,
holding
/
2
,
thisclose
);
底背离止盈买
1
/
2
:
sellshort
(
holding
<
0
and
底背离 ,
holding
/
2
,
thisclose
);
if
barslast
(顶背离)>
1
and
holding
>
0
and
c
<ma2
then
begin
破ma1清多:
sell
(
1
,
0
,
thisclose
);
nums:=
0
;
end
if
barslast
(底背离)>
1
and
holding
<
0
and
c
>ma2
then
begin
破ma1清空:
sellshort
(
1
,
0
,
thisclose
);
nums:=
0
;
end
if
nums>=
0
and
holding
>
0
and
c
<ma2
then
begin
破ma2清多:
sell
(
1
,
0
,
thisclose
);
nums:=
0
;
end
if
nums>=
0
and
holding
<
0
and
c
>ma2
then
begin
破ma2清空:
sellshort
(
1
,
0
,
thisclose
);
nums:=
0
;
end