PHP Code:
/**
Copyright © eSignal, a division of Interactive Data Corporation. 2002. 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);
/* Set the title that will appear in the study pane */
setStudyTitle("Keltner");
/* Set the label that will appear in the cursor window */
setCursorLabelName("K-Upper", 0);
setCursorLabelName("K-Basis", 1);
setCursorLabelName("K-Lower", 2);
setDefaultBarFgColor(Color.blue, 0); // upper
setDefaultBarFgColor(Color.red, 1); // basis
setDefaultBarFgColor(Color.blue, 2); // lower
}
function main(nInputLength) {
if(nInputLength == null)
nInputLength = 1.3;
if(nInputLength <= 16)
nInputLength = 1.3;
var dHigh = high(0, -nInputLength);
var dLow = low(0, -nInputLength);
var dKeltnerBasis= call("KeltnerEMA.efs", nInputLength);
if(dHigh == null || dLow == null || dKeltnerBasis == null)
return;
var dHminL = 0;
var i;
for(i = 0; i < nInputLength; i++) {
dHminL += dHigh[i] - dLow[i];
}
dHminL /= nInputLength;
return new Array(dKeltnerBasis + dHminL, dKeltnerBasis, dKeltnerBasis - dHminL);
}
Comment