NinjaScript > Language Reference > Indicator Methods >

On Balance Volume (OBV)

Print this Topic Previous pageReturn to chapter overviewNext page


OBV is a simple indicator that adds a period's volume when the close is up and subtracts the period's volume when the close is down. A cumulative total of the volume additions and subtractions forms the OBV line. This line can then be compared with the price chart of the underlying security to look for divergences or confirmation.


... Courtesy of StockCharts




OBV(IDataSeries input)


Returns default value
OBV()[int barsAgo]
OBV(IDataSeries input)[int barsAgo]



Return Value

double; Accessing this method via an index value [int barsAgo] returns the indicator value of the referenced bar.





Indicator source data (?)


Number of bars used in the calculation




// Prints the current value of OBV
double value = OBV()[0];
Print("The current OBV value is " + value.ToString());



Source Code

You can view this indicator method source code by selecting the menu Tools > Edit NinjaScript > Indicator within the NinjaTrader Control Center window.