等级: 超级版主
- 注册:
- 2021-5-18
- 曾用名:
|
variable:highp1=0,highp2=0,lowp1=0,lowp2=0;
temp:=ref(close,2);
if max(ref(close,3),ref(close,1))<ref(close,2) then BEGIN
highp2:=highp1;
highp1:=temp;
END
if min(ref(close,3),ref(close,1))>ref(close,2) then BEGIN
lowp2:=lowp1;
lowp1:=temp;
END
temp2:=ref(close,3);
if todaybar<=4 then
begin
lowp2:=temp2;
lowp1:=temp2;
highp2:=temp2;
highp1:=temp2;
end
if highp2<HIGHP1 and ref(close,1)<highp2 and holding<=0 then
begin
sell(1,holding,marketr);
buyshort(1,1,marketr);
END
if lowp2>lowp1 and ref(close,1)>lowp2 and holding>=0 then
begin
sellshort(1,holding,marketr);
buy(1,1,marketr);
END
if holding<0 and close>ref(highp1,enterbars) then sellshort(1,holding,marketr);
if holding>0 and close<ref(lowp1,enterbars) then sell(1,holding,marketr);
//止盈
if holding<0 and close<ref(lowp2,enterbars) then sellshort(1,holding,marketr);
if holding>0 and close>ref(highp2,enterbars) then sell(1,holding,marketr);
//百分比止盈
if holding<0 and (AVGENTERPRICE-close)/AVGENTERPRICE>0.05 then sellshort(1,holding,marketr);
if holding>0 and (close-AVGENTERPRICE)/AVGENTERPRICE>0.05then sell(1,holding,marketr); |
|