Having a hard time what should be an easy task:-
Feeding own arrays with eSignal Built In functions and then retrieving the data for further calculation.
For example following main
START OF CODE
if ( getBarState() == BARSTATE_ALLBARS ){
// Built In
xADX = adx(14,14);
var vADX;
var nADX, nADX_P, vADXDif;
// Create a new array
// ADX Values
var nADXOscLenP=1;
aADX = new Array(nADXOscLenP+1);
// ADX Oscillator
aADXDif = new Array(2);
//
var vADXDif, rADXDif;
return null;
} // END ALLBARS
// ADXDM Values
vADX = getSeries(xADX, 0);
// Feed ADX values to user array
if(getBarState() == BARSTATE_NEWBAR) {
aADX.unshift(vADX);
aADX.pop(); //
} else if(getBarState() == BARSTATE_CURRENTBAR) {
aADX[0]= vADX; //
}
nADX=aADX[0];
nADX_P=aADX[nADXOscLenP-1];
vADXDif=(nADX-nADX_P);
// Feed ADXDif values to user array
if(getBarState() == BARSTATE_NEWBAR) {
aADXDif.unshift(vADXDif);
aADXDif.pop(); //
} else if(getBarState() == BARSTATE_CURRENTBAR) {
aADXDif[0]= vADXDif; //
}
rADXDif=aADXDif[0]-aADXDif[1];
return rADXDif;
END OF CODE
The reason I am not calling the ADX series directly is that in case the period for Oscillator is greater than ADX length that the values of each current nADX is fed into the array.
Until now all the values in aADXOsc array are all the same so I can't calculate a difference.
Any help will be greatly appreciated
Robert
Feeding own arrays with eSignal Built In functions and then retrieving the data for further calculation.
For example following main
START OF CODE
if ( getBarState() == BARSTATE_ALLBARS ){
// Built In
xADX = adx(14,14);
var vADX;
var nADX, nADX_P, vADXDif;
// Create a new array
// ADX Values
var nADXOscLenP=1;
aADX = new Array(nADXOscLenP+1);
// ADX Oscillator
aADXDif = new Array(2);
//
var vADXDif, rADXDif;
return null;
} // END ALLBARS
// ADXDM Values
vADX = getSeries(xADX, 0);
// Feed ADX values to user array
if(getBarState() == BARSTATE_NEWBAR) {
aADX.unshift(vADX);
aADX.pop(); //
} else if(getBarState() == BARSTATE_CURRENTBAR) {
aADX[0]= vADX; //
}
nADX=aADX[0];
nADX_P=aADX[nADXOscLenP-1];
vADXDif=(nADX-nADX_P);
// Feed ADXDif values to user array
if(getBarState() == BARSTATE_NEWBAR) {
aADXDif.unshift(vADXDif);
aADXDif.pop(); //
} else if(getBarState() == BARSTATE_CURRENTBAR) {
aADXDif[0]= vADXDif; //
}
rADXDif=aADXDif[0]-aADXDif[1];
return rADXDif;
END OF CODE
The reason I am not calling the ADX series directly is that in case the period for Oscillator is greater than ADX length that the values of each current nADX is fed into the array.
Until now all the values in aADXOsc array are all the same so I can't calculate a difference.
Any help will be greatly appreciated
Robert
Comment