File Name: NYSE_Volume.efs

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.blue0);
setPlotType(PLOTTYPE_LINE1);
setDefaultBarFgColor(Color.purple1);

}

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 
close("$TVOL");
    var 
open("$TVOL");

    if (
== null || == null) return;

    var 
vValue 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(
0nLengthi++) {
        
vSum += vArray[i];
    }
    var 
vAvgVol vSum nLength;

} else {
    return;
}

if (
vArray.length nLengthvArray.pop(); // Removes last array item

return new Array(vValuevAvgVol);