Barros
To color the background in between values you need to use the optional yMin and yMax parameters in the setBarBgColor() function (see the link for the description and syntax)
For an example of how to implement these parameters see the efs attached to this post.
Alex
I tryed this way, but there is a problem.
Please, could you help me?
This sample eSignal Formula Script (EFS) may be modified and saved under a new
filename; however, eSignal is no longer responsible for the functionality once modified.
eSignal reserves the right to modify and overwrite this EFS file with each new release.
************************************************** ************************************************** */
var study = new BollingerStudy(20, "Close", 2.0);
function main() {
var vUpper = study.getValue(BollingerStudy.UPPER);
var vBasis = study.getValue(BollingerStudy.BASIS);
var vLower = study.getValue(BollingerStudy.LOWER);
return new Array(vUpper, vBasis, vLower);
}
Insert your code following this text block
Use var vUpper = study.getValue(BollingerStudy.UPPER) and
var vBasis = study.getValue(BollingerStudy.BASIS) and
var vLower = study.getValue(BollingerStudy.LOWER) for your code
**************************************************/
setBarBgColor(Color.yellow,1,vEnv.getValue(Bolling erStudy.LOWER),vEnv.getValue(BollingerStudy.UPPER) );
Your setBarBgColor line needs to be before the return new Array line. Something like the following.
function main() {
var vUpper = study.getValue(BollingerStudy.UPPER);
var vBasis = study.getValue(BollingerStudy.BASIS);
var vLower = study.getValue(BollingerStudy.LOWER);
setBarBgColor(Color.yellow,1,vLower,vUpper));
return new Array(vUpper, vBasis, vLower);
}
Thanks for the help, but now I have a new problem:
After I put ir suggestion on, apeared a error:
.......^
Bollinger|BuiltinBB Colors. efs. line 1:
SintaxError: missing ; before statement:
This sample eSignal Formula Script (EFS) may
be modified and saved under a new
var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(20); //Edit this value to set a new default
var fp2 = new FunctionParameter("StdDev", FunctionParameter.NUMBER);
fp2.setLowerLimit(0);
fp2.setDefault(2); //Edit this value to set a new default
var fp3 = new FunctionParameter("Source", FunctionParameter.STRING);
fp3.setName("Source");
fp3.addOption("Close");
fp3.addOption("High");
fp3.addOption("Low");
fp3.addOption("Open");
fp3.addOption("HL/2");
fp3.addOption("HLC/3");
fp3.addOption("OHLC/4");
fp3.setDefault("Close"); //Edit this value to set a new default
}
function main() {
var vUpper = study.getValue(BollingerStudy.UPPER);
var vBasis = study.getValue(BollingerStudy.BASIS);
var vLower = study.getValue(BollingerStudy.LOWER);
setBarBgColor(Color.yellow,1,vLower,vUpper));
return new Array(vUpper, vBasis, vLower);
}
/*************************************************
Insert your code following this text block
Use vBB.getValue(BollingerStudy.UPPER) and
vBB.getValue(BollingerStudy.BASIS) and
vBB.getValue(BollingerStudy.LOWER) for your code
**************************************************/
return new Array (vBB.getValue(BollingerStudy.UPPER),vBB.getValue(B ollingerStudy.BASIS),vBB.getValue(BollingerStudy.L OWER));
}
Comment