Hi,
I was wondering if someone could help me. I do not know how to write esignal code but can describe the logic steps for the indicator.
I am using the standard bollinger bands with length 20 and sd 2.
The keltner formula i am using is this one...... with input length being 20 and ATR being 1.5.
/************************************************** ***************
Provided By : eSignal. (c) Copyright 2003
************************************************** ***************/
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, nRangeFactor) {
if(nInputLength == null)
nInputLength = 20;
if(nInputLength <= 0)
nInputLength = 20;
if(nRangeFactor == null)
nRangeFactor = 2.5;
if(nRangeFactor <= 0)
nRangeFactor = 2.5;
var dHigh = high(0, -nInputLength);
var dLow = low(0, -nInputLength);
var dKeltnerBasis= call("/Library/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 + (nRangeFactor * dHminL), dKeltnerBasis, dKeltnerBasis - (nRangeFactor * dHminL));
}
I want to create a green dot/line if:
1) Bollinger upper band > keltner upper band AND bollinger lower band < keltner lower band.
Create a red dot/line if:
1) Bollinger upper band less than or equal to keltner upper band
2) Bollinger lower band greater than or equal to keltner lower band
3) Bollinger upper band > keltner upper band AND bollinger lower band greater than or equal to keltner lower band
4) Bollinger lower band < keltner lower band AND bollinger upper band less than or equal to keltner lower band
Any help would be greatly appreciated.
Kind regards,
David Dunne
I was wondering if someone could help me. I do not know how to write esignal code but can describe the logic steps for the indicator.
I am using the standard bollinger bands with length 20 and sd 2.
The keltner formula i am using is this one...... with input length being 20 and ATR being 1.5.
/************************************************** ***************
Provided By : eSignal. (c) Copyright 2003
************************************************** ***************/
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, nRangeFactor) {
if(nInputLength == null)
nInputLength = 20;
if(nInputLength <= 0)
nInputLength = 20;
if(nRangeFactor == null)
nRangeFactor = 2.5;
if(nRangeFactor <= 0)
nRangeFactor = 2.5;
var dHigh = high(0, -nInputLength);
var dLow = low(0, -nInputLength);
var dKeltnerBasis= call("/Library/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 + (nRangeFactor * dHminL), dKeltnerBasis, dKeltnerBasis - (nRangeFactor * dHminL));
}
I want to create a green dot/line if:
1) Bollinger upper band > keltner upper band AND bollinger lower band < keltner lower band.
Create a red dot/line if:
1) Bollinger upper band less than or equal to keltner upper band
2) Bollinger lower band greater than or equal to keltner lower band
3) Bollinger upper band > keltner upper band AND bollinger lower band greater than or equal to keltner lower band
4) Bollinger lower band < keltner lower band AND bollinger upper band less than or equal to keltner lower band
Any help would be greatly appreciated.
Kind regards,
David Dunne
Comment