h10:ref(hhv(h,10),1),colorgreen;//前10根K线高点
l10:ref(llv(l,10),1),colorgreen;//前10根K线低点
h20:ref(hhv(h,20),1),colorred;//前20根K线高点
l20:ref(llv(l,20),1),colorred;//前20根K线低点。
long:=cross(c,h20);//价格上穿前20根线高点,做多条件
longend:=cross(l10,c);//价格跌破前10根K线低点,做多终止条件
short:=cross(l20,c);//价格跌破前20根K线低点,做空条件
shortend:=cross(c,h10);//价格上穿前10根K线高点,做空终止条件
if tholding2=0 then begin//
tbuy(long,1,lmt,DYNAINFO( 34));
tbuyshort(short,1,lmt,DYNAINFO( 28));
end
if tholding2<>0 then begin//平仓代码
tsell(longend,1,lmt,DYNAINFO( 28));
tsellshort(shortend,1,lmt,DYNAINFO( 34));
end