[PEL] 复制代码 variable:xtrend:=0,trend2:=0,xu:=0,xu1:=0,xu2:=0,xu3:=0,cl:=0,op:=0,ll:=0,hh:=0,spj:=0;
if barpos=1 and close>=open then
begin
xtrend:=1;
trend2:=xtrend;
xu:=close;
xu1:=open;
xu2:=open;
xu3:=open;
cl:=xu;
op:=xu1;
ll:=op;
hh:=cl;
end
if barpos=1 and close<open then
begin
xtrend:=0;
trend2:=xtrend;
xu:=close;
xu1:=open;
xu2:=open;
xu3:=open;
cl:=xu;
op:=xu1;
ll:=cl;
hh:=op;
end
if barpos>1 and xtrend=1 and close>xu then
begin
trend2:=xtrend;
xu3:=xu2;
xu2:=xu1;
xu1:=xu;
xu:=close;
cl:=xu;
op:=xu1;
ll:=op;
hh:=cl;
end
if barpos>1 and xtrend=1 and close<xu3 then
begin
xtrend:=0;
trend2:=xtrend;
xu:=close;
xu2:=xu1;
xu3:=xu1;
cl:=xu;
op:=xu1;
ll:=cl;
hh:=op;
end
last_cl:=ref(cl,1);
last_op:=ref(op,1);
last_ll:=ref(ll,1);
last_hh:=ref(hh,1);
if barpos>1 and xtrend=1 and (close>xu)=0 and (close<xu3)=0 then
begin
trend2:=xtrend;
cl:=last_cl;
op:=last_op;
ll:=last_ll;
hh:=last_hh;
end
if barpos>1 and xtrend<>1 and close>xu3 then
begin
xtrend:=1;
trend2:=xtrend;
xu:=close;
xu2:=xu1;
xu3:=xu1;
cl:=xu;
op:=xu1;
ll:=op;
hh:=cl;
end
if barpos>1 and xtrend<>1 and close<xu then
begin
trend2:=xtrend;
xu3:=xu2;
xu2:=xu1;
xu1:=xu;
xu:=close;
cl:=xu;
op:=xu1;
ll:=cl;
hh:=op;
end
last_cl:=ref(cl,1);
last_op:=ref(op,1);
last_ll:=ref(ll,1);
last_hh:=ref(hh,1);
if barpos>1 and xtrend<>1 and (close>xu3)=0 and (close<xu)=0 then
begin
trend2:=xtrend;
cl:=last_cl;
op:=last_op;
ll:=last_ll;
hh:=last_hh;
end
需运行在逐K模式下 |