bline:=IF(holding>0,HHV(HIGH,TYPEBAR(1,1))-round(enterprice/w)*mindiff,L-round(enterprice/w)*mindiff);//多单移动止损线
PARTLINE( holding>0, bline, colorrgb(255,0,0));
pd:=(holding>0 and bline>c);
//开空仓条件:
kk:=l<ol and holding=0 and entertime ;
//平空仓条件:
sline:=IF(holding<0,LLV(LOW,TYPEBAR(1,3))+round(enterprice/w)*mindiff,H+round(enterprice/w)*mindiff);//空单移动止损线
PARTLINE(holding<0, sline, colorrgb(0,255,0));
pk:=(holding<0 and sline<c);
sell(pd,holding>0,limitr,c ); //平多
sellshort(pk,holding<0,limitr,c); //平空
这么写只能是收盘过止损线 才会出信号。如何写成触发止损线就平呢?要图表显示和实际一样的。
pd:=(holding>0 and l<bline);
sell(pd,holding,limitr,min(o,bline));
谢谢