variable:max_profit=0;
pp:=OPENPROFIT/(MULTIPLIER*abs(holding));
if pp>5 and pp<10 then max_profit:=1;
if max_profit=1 and (HHV(H,ENTERBARS)-CLOSE)/MULTIPLIER*abs(holding))>=0.61 then sell(1,holding,marketr);
if pp>10 and pp<20 then max_profit:=2;
if max_profit=2 and (HHV(H,ENTERBARS)-CLOSE)/MULTIPLIER*abs(holding))>=0.5 then sell(1,holding,marketr);