Class OBVRenderer

java.lang.Object
com.arbergashi.charts.render.BaseRenderer
com.arbergashi.charts.render.financial.OBVRenderer
All Implemented Interfaces:
ChartRenderer

public final class OBVRenderer extends BaseRenderer

OBVRenderer - On-Balance Volume

Professional OBV indicator renderer for volume-based momentum analysis. Measures buying and selling pressure as a cumulative indicator.

Features:

  • OBV Line: Cumulative volume indicator
  • Trend Identification: Rising OBV = bullish, falling OBV = bearish
  • Divergence Detection: Visual comparison with price
  • Zero Line: Reference baseline

Data Requirements:

Requires price (close) and volume data.

Calculation:

If Close > PrevClose: OBV = PrevOBV + Volume
If Close < PrevClose: OBV = PrevOBV - Volume
If Close = PrevClose: OBV = PrevOBV

Interpretation:

  • Rising OBV = Accumulation (bullish)
  • Falling OBV = Distribution (bearish)
  • OBV confirms trend if it moves with price
  • Divergence = potential reversal signal
Since:
2026-01-01
Version:
1.0.0
Author:
Arber Gashi
  • Constructor Details

    • OBVRenderer

      public OBVRenderer()
  • Method Details

    • drawData

      protected void drawData(Graphics2D g, ChartModel model, PlotContext context)
      Description copied from class: BaseRenderer
      Implementation-specific drawing logic. Must follow Zero-Allocation rules.
      Specified by:
      drawData in class BaseRenderer
    • getPreferredYRange

      public double[] getPreferredYRange(ChartModel model)
      Description copied from interface: ChartRenderer
      Optional Y-range override for autoscaling.

      Renderers may return a {minY, maxY} array when the visible range should be based on derived data rather than the model's raw Y-values (e.g. indicators like MACD).

      Parameters:
      model - the layer model
      Returns:
      {minY, maxY} or null to use model Y-values