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:
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.green, 0);
setDefaultBarFgColor(Color.black, 1);
setDefaultBarFgColor(Color.red, 2);
setDefaultBarThickness(8, 0);
setDefaultBarThickness(6, 1);
setDefaultBarThickness(4, 2);
setPlotType(PLOTTYPE_HISTOGRAM, 0);
setPlotType(PLOTTYPE_HISTOGRAM, 1);
setPlotType(PLOTTYPE_HISTOGRAM, 2);
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 == true) vPrevVol = vVol;
var nTempAsk = getMostRecentAsk();
var nTempBid = getMostRecentBid();
if (nTempAsk != null && nTempAsk != 0) nAsk = nTempAsk;
if (nTempBid != null && nTempBid != 0) nBid = 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(nAskVol, nInsideVol, nBidVol);
}