// IBS indicator and optimize threshold parameters
IBS = (close-low) / (high-low);
optimize("thl",0,0.3,0.05);
optimize("thh",0.7,1,0.05);
// Buy rules
Rule1 = IBS < thl;
// Short rules
Rule2 = IBS > thh;
buy = Rule1;
sell=close;
short= Rule2;
cover=close;