求一个止盈的写法。
最高盈利达1000点以后,如果出现某收盘价跌破20周期最低点,则以此收盘价止盈。自己写了如下,但应用于图不出现止盈。请高手帮忙看看。或者帮忙写个策略。多谢。
variable: hprice=0;
if holding=0 then begin
if Longcond then begin
buy(1,1,thisclose);
hprice:=h;
end
end
HLN:=ref(LLV(LOW,20),1);
if holding>0 and h>=hprice then begin
hprice:=h;
if hprice-enterprice>1000 then begin
if c<HLN then begin
多止盈: sell(1,holding,thisclose);
end
end
variable: hprice=0;
HLN:=ref(LLV(LOW,20),1);
longcond:=cross(ma(c,5),ma(c,10));
if Longcond then begin
buy(holding=0,1,thisclose);
hprice:=h;
end
if holding>0 and h>=hprice then begin
hprice:=h;
end
if hprice-enterprice>50 then begin
if c<HLN then begin
多止盈: sell(1,holding,thisclose);
end
end