if h>1200 and h<1250 then buy(holding=0,1,thisclose);
if l<1150 and hhv(h,enterbars+1)>1200 and hhv(h,enterbars+1)<1250 then sell(1,0,thisclose);
if h>=1250 then buy(holding=1 or holding=0,1,thisclose);
if l<1200 and hhv(h,enterbars+1)>=1250 then sell(1,0,thisclose);