if enterbars>0 and openprofit<5000 then begin
sellshort(1,0,market);
sell(1,0,market);
end
if enterbars>0 and hhv(openprofit,enterbars+1)>5000 and openprofit<hhv(openprofit,enterbars+1)*0.5 then begin
sell(1,0,market);
sellshort(1,0,market);
end