Announcement

Collapse
No announcement yet.

Volume w/ Moving Average

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

  • Volume w/ Moving Average

    File Name: Volume_with_MA.efs

    Description:
    This plots a moving average on a volume indicator.

    Formula Parameters:
    nMALength - Defines the length of the Moving Average. Default is 10.

    Download File:
    Volume_with_MA.efs



    EFS Code:
    PHP Code:
    /*************************
    Copyright © eSignal, 2003
    **************************
    Description: Displays volume with moving average
    */

    var study null;

    function 
    preMain() {
        
        
    setStudyTitle("Volume with MA");
        
    setCursorLabelName("Volume",0);
        
    setCursorLabelName("MA",1);
        
        
    setPlotType(PLOTTYPE_HISTOGRAM,0);
    }

    var 
    vMAArray = new Array();

    function 
    main(nMALength) {

        if (
    nMALength == null) {
            
    nMALength 10;
        }    
        else {
            
    nMALength Math.round(nMALength);
        }

        
    // Get data
        
    var vVol volume();
        var 
    vOpen open();
        var 
    vClose close();
        
        if (
    vVol == null) return;
        
        var 
    nBarState getBarState();
        
        if (
    nBarState == BARSTATE_NEWBAR) {
            
            
    vMAArray.unshift(vVol);   //inserts array element to the front of the array
        
        
    }

        
    vMAArray[0] = vVol;

        if (
    vMAArray[nMALength-1] != null) {
            
            var 
    vSum 0;
            
            for (
    i=0<= nMALength-1i++) {
                
    vSum += vMAArray[i];
            }
            var 
    vMAofVol vSum nMALength;
            
        } else return;
        
        if (
    vOpen <= vClosesetBarFgColor(Color.green0);
        if (
    vOpen vClosesetBarFgColor(Color.red0);
        
        return new Array (
    vVolvMAofVol);


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