平仓信号出现白箭头,是什么原因?
平仓逻辑清晰:1,持仓enterbars>1 ,持仓周期大于3周期收盘价平仓;
2,止盈h>=enterprice+p2/1000*enterprice
l>=enterprice-p2/1000*enterprice
最高价或最低价达到指定价平仓
3,止损l<=enterprice-p1/1000*enterprice
h>=enterprice+p1/1000*enterprice
最低价或最高价达到指定价平仓
if holding>0 then begin
if enterbars>1 then begin
sell(1,holding,limitr,close);
//sell(1,holding,marketr);
myexitprice:=0;
end
if h>=enterprice+p2/1000*enterprice then begin
myexitprice:=enterprice+p2/1000*enterprice;
//sell(1,holding,marketr);
sell(1,holding,limitr,myexitprice);
myexitprice:=0;
end
if l<=enterprice-p1/1000*enterprice then begin
myexitprice:=enterprice-p1/1000*enterprice;
//sell(1,holding,marketr);
sell(1,holding,limitr,myexitprice);
myexitprice:=0;
end
end
//盈亏计算
if holding<0 then begin
if enterbars>1 then begin
sellshort(1,holding,limitr,close);
//sellshort(1,holding,marketr);
myexitprice:=0;
end
if l>=enterprice-p2/1000*enterprice then begin
myexitprice:=enterprice-p2/1000*enterprice;
//sellshort(1,holding,marketr);
sellshort(1,holding,limitr,myexitprice);
myexitprice:=0;
end
if h>=enterprice+p1/1000*enterprice then begin
myexitprice:=enterprice+p1/1000*enterprice;
//sellshort(1,holding,marketr);
sellshort(1,holding,limitr,myexitprice);
myexitprice:=0;
end
end