Q2. Are there any restrictions in mixing studies in function called with efsInternal?
If not, can anybody help me understand why I get incorrect results in the following setup?
function main() {
stAvBar = efsInternal("CalcAvBarF"); //This behaves as expected.
stBB = new BollingerStudy(Per, Source, Dev);
stBand = efsInternal("CalcBandF", stBB, stAvBar);
return stBand.getValue();
}
function CalcBandF(BBStudy, AvBarStudy) {
var BBH = BBStudy.getValue(BollingerStudy.UPPER);
var BBL = BBStudy.getValue(BollingerStudy.LOWER);
var Bar = AvBarStudy.getValue();
return (BBH-BBL)/Bar;
}
If I do not create a series, but call the [almost] same function each bar, I get correct results. Here is how:
function main() {
stAvBar = efsInternal"CalcAvBarF"); //Same as above
stBB = New BollingerStudy(Per, Source, Dev); //Same as above
var AvBar = AvBarStudy.getValue(); //Actually, this is a global var
var Band = CalcBand(BBStudy, AvBar); //This is ok, but not a series
return Band;
}
function CalcBandF(BBStudy, Bar) {
//Same calculation and return
}
Thank you,
Mihai
If not, can anybody help me understand why I get incorrect results in the following setup?
function main() {
stAvBar = efsInternal("CalcAvBarF"); //This behaves as expected.
stBB = new BollingerStudy(Per, Source, Dev);
stBand = efsInternal("CalcBandF", stBB, stAvBar);
return stBand.getValue();
}
function CalcBandF(BBStudy, AvBarStudy) {
var BBH = BBStudy.getValue(BollingerStudy.UPPER);
var BBL = BBStudy.getValue(BollingerStudy.LOWER);
var Bar = AvBarStudy.getValue();
return (BBH-BBL)/Bar;
}
If I do not create a series, but call the [almost] same function each bar, I get correct results. Here is how:
function main() {
stAvBar = efsInternal"CalcAvBarF"); //Same as above
stBB = New BollingerStudy(Per, Source, Dev); //Same as above
var AvBar = AvBarStudy.getValue(); //Actually, this is a global var
var Band = CalcBand(BBStudy, AvBar); //This is ok, but not a series
return Band;
}
function CalcBandF(BBStudy, Bar) {
//Same calculation and return
}
Thank you,
Mihai
Comment