Announcement

Collapse
No announcement yet.

BidAskVolume.efs

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

  • BidAskVolume.efs

    File Name: BidAskVolume.efs

    Description:
    Tracks volume traded at the Bid, Ask and inside the bid/ask spread. Displays the volume in three histograms, green (ask), red (bid) and black (inside).

    Formula Parameters:
    Analysis: Bar [Bar, Cumulative]

    Notes:
    When the formula is first applied to the chart, there will not be any volume information displayed. The formula will then begin collecting data as trades occur and display the data in real time going forward.

    Download File:
    BidAskVolume.efs



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

    Version: 2.1

    Notes:
        2.0
        - Added validation for 0 bid/ask data.
        2.1
        - Added option for plotting cumulative data.
        
    Formula Parameters:                     Defaults:
    Analysis                                Bar
        [Bar, Cumulative]
    **************/

    function preMain() {
        
    setStudyTitle("Bid\/Ask Volume ");
        
    setCursorLabelName("Ask Vol"0);
        
    setCursorLabelName("Inside Vol"1);
        
    setCursorLabelName("Bid Vol"2);
        
    setDefaultBarFgColor(Color.green0);
        
    setDefaultBarFgColor(Color.black1);
        
    setDefaultBarFgColor(Color.red2);
        
    setDefaultBarThickness(80);
        
    setDefaultBarThickness(61);
        
    setDefaultBarThickness(42);
        
    setPlotType(PLOTTYPE_HISTOGRAM0);
        
    setPlotType(PLOTTYPE_HISTOGRAM1);
        
    setPlotType(PLOTTYPE_HISTOGRAM2);

        var 
    fp0 = new FunctionParameter("sType"FunctionParameter.STRING);
            
    fp0.setName("Analysis");
            
    fp0.addOption("Bar");
            
    fp0.addOption("Cumulative");
            
    fp0.setDefault("Bar");
    }

    var 
    nBidVol 0;
    var 
    nInsideVol 0;
    var 
    nAskVol 0;
    var 
    vVol null;
    var 
    bPrimed false;
    var 
    nAsk null;
    var 
    nBid null;

    function 
    main(sType) {
        if (
    getCurrentBarIndex() < 0) return;

        var 
    nState getBarState();    
        if (
    nState == BARSTATE_NEWBAR) {
            if (
    sType == "Bar" || day(0) != day(-1)) {
                
    nBidVol 0;
                
    nInsideVol 0;
                
    nAskVol 0;
            }
            
    vVol 0;
        }
        
        var 
    vPrevVol null;
        if (
    vVol != null && bPrimed == truevPrevVol vVol;
        
        var 
    nTempAsk getMostRecentAsk();
        var 
    nTempBid getMostRecentBid();
        if (
    nTempAsk != null && nTempAsk != 0nAsk nTempAsk;
        if (
    nTempBid != null && nTempBid != 0nBid nTempBid;

        var 
    vClose close();
        
    vVol volume();
        
        var 
    vTradeVol vVol vPrevVol;
        
        if (
    bPrimed == false && vVol != null) {
            
    bPrimed true;
            return;
        } else {
            if (
    vClose <= nBid) {
                
    nBidVol += vTradeVol;
            } else if (
    vClose >= nAsk) {
                
    nAskVol += vTradeVol;
            } else {
                
    nInsideVol += vTradeVol;
            }
        }
        
        return new Array(
    nAskVolnInsideVolnBidVol);

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation
Working...
X