function preMain() {
setPriceStudy(true);
setStudyTitle("HH-LL");
setColorPriceBars(true);
setDefaultPriceBarColor(Color.black);
var fp1 = new FunctionParameter("nInputLength", FunctionParameter.NUMBER);
fp1.setName("Length");
fp1.setLowerLimit(1);
fp1.setDefault(20);
}
function main(nInputLength) {
var vC = close(0);
var vPH = high(-1);
var vPL = low(-1);
if(vC == null || vPH == null || vPL == null) return;
if (high(0) > vPH) {
setPriceBarColor(Color.green);
}
if(low(0) < vPL) {
setPriceBarColor(Color.red);
}
if(low(0) > vPL && high(0) < vPH) {
setPriceBarColor(Color.blue);
}
return;
}