Hi,
I'm trying to understand efsLib creation and retrieving multiple returns. The only forum reference I found and tried to follow is at: http://forum.esignalcentral.com/show...ighlight=myLib
However it returns "TypeError: LagReturn has no properties"
Any help is appreciated to include good links/resources for coding and retrieving multiple data from efsLib.
Both the efsLib and the calling efs follow:
efsLib:
Calling efs:
wayne
I'm trying to understand efsLib creation and retrieving multiple returns. The only forum reference I found and tried to follow is at: http://forum.esignalcentral.com/show...ighlight=myLib
However it returns "TypeError: LagReturn has no properties"
Any help is appreciated to include good links/resources for coding and retrieving multiple data from efsLib.
Both the efsLib and the calling efs follow:
efsLib:
PHP Code:
var bInit = false;
var L0_1 = 0;
var L1_1 = 0;
var L2_1 = 0;
var L3_1 = 0;
var L0 = 0;
var L1 = 0;
var L2 = 0;
var L3 = 0;
var xhl2 = null;
function Laguerre(gamma) {
if(gamma == null)
gamma = 0.8;
if (bInit == false) {
xhl2 = hl2();
bInit = true;
}
if (getBarState() == BARSTATE_NEWBAR) {
L0_1 = L0;
L1_1 = L1;
L2_1 = L2;
L3_1 = L3;
}
var Filt = 0;
var FIR = 0;
var sum = 0;
var i = 0;
L0 = (1 - gamma) * xhl2.getValue(0) + gamma * L0_1;
L1 = -gamma * L0 + L0_1 + gamma * L1_1;
L2 = -gamma * L1 + L1_1 + gamma * L2_1;
L3 = -gamma * L2 + L2_1 + gamma * L3_1;
Filt = (L0 + 2 * L1 + 2 * L2 + L3) / 6;
for (i = - 3; i <= 0; i++) {
if (i == 0 || i == -3)
k = 1;
else
k = 2;
sum += k * xhl2.getValue(i);
}
FIR = sum / 6;
if (getCurrentBarCount() < 50) return;
return new Array(Filt, FIR);
}
PHP Code:
//http://forum.esignalcentral.com/showthread.php?threadid=16410&highlight=myLib
//calls "LaguerreFilter.efsLib"
debugClear();
var aFPArray = new Array();
var LAGUER = addLibrary ("LaguerreFilter.efsLib");
function preMain() {
setPriceStudy(true);
setStudyTitle("FIR");
setCursorLabelName("Filt", 0);
setDefaultBarFgColor(Color.red, 0);
setDefaultBarThickness(2, 0);
setCursorLabelName("FIR", 1);
setDefaultBarFgColor(Color.green, 1);
setDefaultBarThickness(2, 1);
var x = 0;
aFPArray[x] = new FunctionParameter("gamma", FunctionParameter.NUMBER);
with(aFPArray[x++]) {
setName("Gamma");
setLowerLimit(0.01);
setDefault(0.8);
}
}
var bInit = false;
var vFilt = null;
var vFIR = null;
function main(gamma) {
if (bInit == false) {
vFilt = efsInternal("fLAGUER", 0, gamma);
vFIR = efsInternal("fLAGUER", 1, gamma);
bInit = true;
}
var xFilt = getSeries(vLAGUER, 0);
var xFIR = getSeries(vLAGUER, 1);
return new Array(xFilt, xFIR);
}
/****efsInternal*********/
var LagReturn = null;
function fLAGUER(n,g) {
if (LagReturn == null) LagReturn = LAGUER.Laguerre(g);
return LagReturn[n];
}
Comment