写了一段后台交易的公式,希望在盈利大于10个点以后,如果回调超过盈利的50%就平仓
请教高手,我模拟了一下,达到条件后公式没有发出平仓指令,不知哪有问题,请高手赐教
谢谢
这是代码
BO:=tHOLDING>0 AND tENTERBARS>=1;
SO:=tHOLDING<0 AND tENTERBARS>=1;
if bo then
begin
TP1:=HHV(high,tENTERBARS);
end
if so then
begin
TP2:=LLV(low,tENTERBARS);
end
IF BO AND (TP1-tenterprice)>10 AND (c-tenterprice)/(TP1-tenterprice)<=0.5 THEN tSELL(1,0,LMT,C);
IF SO AND (tenterprice-TP2)>10 AND (tenterprice-c)/(tenterprice-TP2)<=0.5 THEN tSELLSHORT(1,0,LMT,C);