input:upperN(100,50,150,10),upN(50,30,100,10),downN(50,30,100,10),downerN(100,50,150,10);
KLineNum:=BARSLAST(day<>ref(day,1));
OpenPrice:ref(o,KLineNum);
t1:=time>=092000 and time<=144000;
//上轨:开盘价+1%
upper:OpenPrice*(1+0.01*0.01*upperN);
//中上轨:开盘价+0.5%
up:OpenPrice*(1+0.01*0.01*upN);
//中下轨:开盘价-0.5%
down:OpenPrice*(1-0.01*0.01*downN);
//下轨:开盘价-1%
downer:OpenPrice*(1-0.01*0.01*downerN);
//开多:突破上轨 or (最低价不破下轨 and 上穿中下轨;
long:=c>upper or (llv(l,KLineNum)>downer and l<down and c>down);
//平多:反向走0.5%出局
longend:=holding>0 and (enterprice-c)/enterprice>=0.5*0.01;
//开空:突破下轨 or (最高价不丰上轨 and 下穿中上轨)
short:=c<downer or (hhv(h,KLineNum)<upper and h>up and c<up);
//平空:反向走0.5%出局
shortend:=holding<0 and (c-enterprice)/enterprice>=0.5*0.01;
if holding>0 and longend then sell(1,1,thisclose);
if holding<0 and shortend then sellshort(1,1,thisclose);
if holding=0 and t1 and long then buy(1,1,thisclose);
if holding=0 and t1 and short then buyshort(1,1,thisclose);
if time>150900 then BEGIn
sell(holding>0,holding,thisclose);
sellshort(holding<0,abs(holding),thisclose);
end