Modified on 2008/05/03 08:50 by Administrator — Categorized as: Standard Indicators


public OBV(Bars bars, string description)
public static OBV Series(Bars bars)

Parameter Description

bars The Bars object


On Balance Volume developed by Joseph Granville and described in his New Key to Stock Market Profits, uses volume to gauge the strength of a market. If prices close up, the current bar's volume is added to OBV, and if prices close down, it is subtracted. The result is an indicator that depicts the flow of volume into and out of a security. It either confirms the quality of the current trend or warn of an impending reversals.

You can often spot divergences between price action and the OBV indicator. For example, if prices make a new high but the move is not accompanied by sufficient volume, OBV will fail to make a new high. Such divergences can be a sign that a trend is nearing completion.


The actual value of the OBV is unimportant, concentrate on its direction.


"...the total daily volume is added to a cumulative total whenever the price of a stock closes higher than the day before and it is subtracted whenever the price of the stock closes lower than the day before. On days when the stock closes unchanged in price, the running cumulative volume remains unchanged." (Granville, p. 144)


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // This simple systems buys and sells based on a moving average crossover of OBV WealthLab.Indicators.EMACalculation m = WealthLab.Indicators.EMACalculation.Modern; DataSeries obv = OBV.Series( Bars ); DataSeries OBV1 = EMA.Series( obv, 24, m ); DataSeries OBV2 = EMA.Series( obv, 48, m );

for(int bar = 48*3; bar < Bars.Count; bar++) { if( CrossOver( bar, OBV1, OBV2 ) ) BuyAtMarket( bar+1 ); else if( CrossUnder( bar, OBV1, OBV2 ) ) SellAtMarket( bar+1, Position.AllPositions, "OBV" ); } ChartPane OBVPane = CreatePane( 40, false, true ); PlotSeries( OBVPane, obv, Color.Brown, WealthLab.LineStyle.Solid, 2 ); PlotSeries( OBVPane, OBV1, Color.Black, WealthLab.LineStyle.Dotted, 2 ); PlotSeries( OBVPane, OBV2, Color.Red, WealthLab.LineStyle.Dotted, 2 ); } } }