if time=opentime(0) then begin
step:=0;
end
if ( close - enterprice<30*MINDIFF and step <= 1) then
begin
stopBuyLine:= enterprice - max(50*MINDIFF*atr,50*MINDIFF),nodraw;
step: = 1,nodraw;
end;
else
if (close - enterprice>=30*MINDIFF and close - enterprice<昨收*0.01
and ( step=1 or step=2 ) ) then
begin
stopBuyLine:= enterprice + 10*MINDIFF;
step: = 2,nodraw;
end;
else
if (close - enterprice>=昨收*0.01 and close - enterprice<昨收*0.02
and ( step=2 or step=3 ) ) then
begin
stopBuyLine:= enterprice + (close - enterprice)*0.5 ,nodraw;
step:=3,nodraw;
end;
else
if (close - enterprice > 昨收*0.02 and ( step=3 or step=4 )) then
begin
stopBuyLine:= enterprice + (close - enterprice)*0.65 ,nodraw;
step:=4,nodraw;
end;
end;
初始语句是这段代码if time=opentime(0) then begin
step:=0;
end
1、多单移动止损:当价格往成本上方移动30跳(6个点),将止损移至成本上方10跳。当价格往上移动1%,移动止损移至保护利润的50%,当价格往上移动2%以上,移动止损移至保护利润的65%。
variable:step=0;
if ( close - enterprice<30*MINDIFF and step <= 1) then
begin
stopBuyLine:= enterprice - max(50*MINDIFF*atr,50*MINDIFF),nodraw;
step: = 1,nodraw;
end;
else
if (close - enterprice>=30*MINDIFF and close - enterprice<昨收*0.01
and ( step=1 or step=2 ) ) then
begin
stopBuyLine:= enterprice + 10*MINDIFF;
step: = 2,nodraw;
end;
else
if (close - enterprice>=昨收*0.01 and close - enterprice<昨收*0.02
and ( step=2 or step=3 ) ) then
begin
stopBuyLine:= enterprice + (close - enterprice)*0.5 ,nodraw;
step:=3,nodraw;
end;
else
if (close - enterprice > 昨收*0.02 and ( step=3 or step=4 )) then
begin
stopBuyLine:= enterprice + (close - enterprice)*0.65 ,nodraw;
step:=4,nodraw;
end;
end;