obv() Built-in Study Functions
On Balance Volume (OBV) is a cumulative total of volume. It shows if volume is flowing into or out of a security. When an issue closes higher than its previous close, all of the day's volume is considered to be up-volume. When the issue closes lower than the previous close, all of the day's volume is considered to be down-volume.
Syntax
obv( [ sym() | inv() ][, nBarIndex ] )
Parameters
Parameter: | Description: | Default: |
sym() or inv() |
[Optional] Function of sym() or inv() to determine symbol/interval source for the study. | Chart's sym/inv |
nBarIndex | [Optional] Bar index of series to retrieve . | n/a |
Return Value(s)
Returns a Series Object when nBarIndex is not specified.
Returns a single value when nBarIndex is specified.
Notes
Only available in versions 7.9 or later.
The obv() built-in study function does not accept another built-in series or custom series as the source other than sym() or inv().
Code Examples
function main() { return obv(); }
function main() { var nValue_0 = obv(0); // Current Bar Index var nValue_1 = obv(-1); // Prior Bar Index return new Array(nValue_0, nValue_1); }
var xStudy = null; function main() { if (xStudy == null) { xStudy = obv(); } // retrieve single values for conditional statements var nValue_0 = xStudy.getValue(0); // Current Bar Index value var nValue_1 = xStudy.getValue(-1); // Prior Bar Index value return nValue_0; // Plot Current Bar Index Value }
var xStudy = null; var bInit = false; // Initialization flag function main() { if (bInit == false) { xStudy = obv(inv(20)); // 20-min interval bInit = true; } // retrieve single values for conditional statements var nValue_0 = xStudy.getValue(0); // Current Bar Index value var nValue_1 = xStudy.getValue(-1); // Prior Bar Index value return getSeries(xStudy); // Synchronized Series plot }
var xStudy = null; var bInit = false; // Initialization flag function main() { if (bInit == false) { xStudy = obv(sym("IBM,20")); // IBM 20-min interval bInit = true; } // retrieve single values for conditional statements var nValue_0 = xStudy.getValue(0); // Current Bar Index value var nValue_1 = xStudy.getValue(-1); // Prior Bar Index value return getSeries(xStudy); // Synchronized Series plot }
See Also
Series Object
getSeries()
Built-in Study Functions
eSignal Forum Search Engine
Help Guides and Tutorials