如何在交易策略中能够记录开仓和平仓的价格,并且在开仓时设置国定止损比例1%,并画止损线,平仓时再取消已经画过的止损线!
可以举例说明:以5天线金叉10天线为买入,用固定轮询发交易,记录当时的开仓价格,并且按照开仓价*0.99作为止损价格,并且划线;
等到5天线死叉10天线时为平多仓信号,并取消原来的止损线;然后记录死叉的价格卖空,并画开仓价格*1.01的止损线?
如果做得更好,要求盘中有多个信号时,能做到只记录首个开仓信号并画止损线;
5天的什么线金叉10天的什么线?
variable:aa=0;
if cond1 then begin
sellshort(holding<0,0,thisclose);
buy(holding=0,1,thisclose);
end
if cond2 then begin
sell(holding>0,0,thisclose);
buyshort(holding=0,1,thisclose);
end
if holding<>ref(holding,1) then begin
aa:=enterprice;
end
drawline(holding>0,aa*0.99,holding<0,ref(aa,1)*0.99,0);
drawline(holding<0,aa*1.01,holding>0,ref(aa,1)*1.01,0);
如何改平仓 后让前面的止损线消失我再想想