代码写法上除了冗余外,逻辑判断上没有问题。(如果是5%,应该是5而不是0.5)
可以调整下代码,并通过debugfile输出结果看下。
[PEL] 复制代码 a22:=(c-tenterprice)/tenterprice*100>=5;
tbuyshort(a20 and tsellholding(1)=0 ,ss ,lmt,dynainfo(28));
if c<tenterprice then tsellshort(a21 ,tsellholding(1) ,lmt,dynainfo(34));
b20:=b10 and b11;
b21:=jdma515f>=0 and jdma20>=0;
b22:=(tenterprice-c)/tenterprice*100>=5;
tbuy(b20 and tbuyholding(1)=0 ,ss ,lmt,dynainfo(34));
if c>tenterprice then tsell(b21 ,tbuyholding(1) ,lmt,dynainfo(28));
//输出参与止损的各个因子结果。
DEBUGFILE('d:\'&STKLABEL&'.TXT','close='&NUMTOSTR(close,2)& ' tenterprice='& NUMTOSTR(tenterprice,2) & ' tbuyholding='& NUMTOSTR(tbuyholding(1),0),1);
if a22=1 then tsellshort(1 ,tsellholding(1) ,lmt,dynainfo(34));
if b22=1 then tsell(1 ,tbuyholding(1) ,lmt,dynainfo(28)); |