File Name: CumulativeVolumeIndex.efs
Description:
Cumulative Volume Index
Formula Parameters:
Exchange : NYSE
Notes:
Download File:
CumulativeVolumeIndex.efs
EFS Code:
Description:
Cumulative Volume Index
Formula Parameters:
Exchange : NYSE
Notes:
Download File:
CumulativeVolumeIndex.efs
EFS Code:
PHP Code:
/*********************************
Provided By:
eSignal (Copyright c eSignal), a division of Interactive Data
Corporation. 2009. All rights reserved. This sample eSignal
Formula Script (EFS) is for educational purposes only and may be
modified and saved under a new file name. eSignal is not responsible
for the functionality once modified. eSignal reserves the right
to modify and overwrite this EFS file with each new release.
Description:
Cumulative Volume Index
Version: 1.0 07/06/2009
Formula Parameters: Default:
Exchange NYSE
Notes:
**********************************/
var fpArray = new Array();
var bInit = false;
function preMain(){
setPriceStudy(false);
setStudyTitle("Cumulative Volume Index");
setCursorLabelName("CumVol");
var x=0;
fpArray[x] = new FunctionParameter("sExchange", FunctionParameter.STRING);
with(fpArray[x++]){
setName("Exchange");
addOption("NYSE");
addOption("NASDAQ");
setDefault("NYSE");
}
}
var xCumVolIdx = null;
function main(sExchange) {
var nBarState = getBarState();
if (nBarState == BARSTATE_ALLBARS) {
if (sExchange == null) sExchange = "NYSE";
}
if(!bInit){
xCumVolIdx = efsInternal("Calc_CumVol", sExchange);
}
return xCumVolIdx.getValue(0);
}
var xAdvance = null;
var xDecline = null;
function Calc_CumVol(_exchange){
if(getBarState() == BARSTATE_ALLBARS){
if(_exchange == "NYSE") {
xAdvance = close(sym("$UVOL"));
xDecline = close(sym("$DVOL"));
}else if(_exchange == "NASDAQ") {
xAdvance = close(sym("$UVOLQ"));
xDecline = close(sym("$DVOLQ"));
}
}
if(xAdvance.getValue(-2) == null || xDecline.getValue(-2) == null) return;
if(getCurrentBarCount() > 1) var nRef = ref(-1);
var CumVol = nRef+(xAdvance.getValue(0) - xDecline.getValue(0));
return CumVol;
}