On Balance Volume |
Top Previous Next |
obv( [, sym() | inv()] [, barIndex] )
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.
Parameters
To Create a Series
var myStudy = null; var bInit = false;
function main() { var myVar;
if ( bInit == false ) {
myStudy = obv(); bInit = true;
}
//retrieve the current value myVar = myStudy.getValue(0);
return( myVar );
}
To Retrieve a Single Value
function main() {
... ... myVar = obv();
//do something with the value in myVar
}
Calling Examples
//create a study that uses IBM as the symbol along with whatever bar //interval you are using in the chart where the script is loaded myStudy = obv( sym( "IBM") );
//create a study that uses the 15-min bar interval, regardless of the bar //interval of the chart in which the script is loaded myStudy = obv( inv(15) );
//create a study that uses the Daily bar interval, regardless of the bar //interval of the chart in which the script is loaded myStudy = obv( inv("D") );
//create a study that will be based on MSFT 30-min bars, regardless of //the symbol/bar interval of the chart in which the script is loaded. myStudy = obv( sym( "MSFT,30" ) );
|