Description:
Displays a volume histogram for the $NYA by using the
open of $TVOL - the close of $TVOL for intraday intervals.
There is also a moving average built in, which can be adjusted
through the nLength parameter.
Formula Parameters:
nLength - Defines the length of the Moving Average. Default is 50.
Download File:
NYSE_Volume.efs
EFS Code:
PHP Code:
/***************************************
Provided By : eSignal. (c) Copyright 2003
****************************************
*/
function preMain() {
setStudyTitle("NYSE Volume");
setCursorLabelName("NYSE Vol", 0);
setCursorLabelName("Avg. Vol", 1);
setPlotType(PLOTTYPE_HISTOGRAM,0);
setDefaultBarThickness(3);
setDefaultBarFgColor(Color.blue, 0);
setPlotType(PLOTTYPE_LINE, 1);
setDefaultBarFgColor(Color.purple, 1);
}
var vArray = new Array();
var vInterval = getInterval();
function main(nLength) {
if (nLength == null) {
nLength = 50;
} else {
nLength = Math.round(nLength);
}
if (vInterval == "D" || vInterval == "W" || vInterval == "M") {
var vValue = close("$TVOL");
} else {
var c = close("$TVOL");
var o = open("$TVOL");
if (c == null || o == null) return;
var vValue = c - o;
}
var nBarState = getBarState();
if (nBarState == BARSTATE_NEWBAR) {
vArray.unshift(vValue); //inserts array element to the front of the array
} else {
vArray[0] = vValue;
}
if (vArray[nLength-1] != null) { // check to make sure array is full
var vSum = 0;
for(i = 0; i < nLength; i++) {
vSum += vArray[i];
}
var vAvgVol = vSum / nLength;
} else {
return;
}
if (vArray.length > nLength) vArray.pop(); // Removes last array item
return new Array(vValue, vAvgVol);
}