Announcement

Collapse
No announcement yet.

$COMPQ Volume Histogram

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • $COMPQ Volume Histogram

    File Name: COMPQ_Volume.efs

    Description:
    Displays a volume histogram for the $COMPQ by using the
    open of $TVOLQ - the close of $TVOLQ 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:
    COMPQ_Volume.efs



    EFS Code:
    PHP Code:
    /***************************************************
    Provided By : eSignal. (c) Copyright 2003
    ***************************************************/

    function preMain() {
    setStudyTitle("Nasdaq Volume");
    setCursorLabelName("Nasdaq 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("$TVOLQ");
    } else {
        var 
    close("$TVOLQ");
        var 
    open("$TVOLQ");

        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);


    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11
Working...
X