I want to be able to have candles colored based upon Stoch Level. I have found the MAPriceBars Formula that does it based upon MA so I thought it would work to start with that. Here is the code for MAPriceBars.efs, can someone tell me how to change it so that the colors are based upon Stoch Study being above 80 mor below 20. I do not know anything about efs yet other than I can edit it. Thanks in advance for any help.
/************************************************** **************************************************
Copyright © eSignal, a division of Interactive Data Corporation. 2006. All rights reserved.
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.
************************************************** ************************************************** */
function preMain() {
setPriceStudy(true);
setStudyTitle("Stoch PriceBars");
setCursorLabelName("sto");
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 nMA = sma(nInputLength, 0);
var vClose = close(0);
if(nMA == null || vClose == null) return;
if(nMA >= vClose) {
setPriceBarColor(Color.red);
} else if(nMA < vClose) {
setPriceBarColor(Color.lime);
}
return nMA;
}
/************************************************** **************************************************
Copyright © eSignal, a division of Interactive Data Corporation. 2006. All rights reserved.
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.
************************************************** ************************************************** */
function preMain() {
setPriceStudy(true);
setStudyTitle("Stoch PriceBars");
setCursorLabelName("sto");
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 nMA = sma(nInputLength, 0);
var vClose = close(0);
if(nMA == null || vClose == null) return;
if(nMA >= vClose) {
setPriceBarColor(Color.red);
} else if(nMA < vClose) {
setPriceBarColor(Color.lime);
}
return nMA;
}
Comment