Class ATRRenderer

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

public final class ATRRenderer extends BaseRenderer

ATRRenderer - Average True Range

Professional ATR indicator renderer for volatility measurement. ATR measures market volatility by decomposing the entire range of an asset price.

Features:

  • ATR Line: 14-period average true range (default)
  • Volatility Bands: Optional bands at ±1 ATR
  • Smooth Rendering: Uses Wilder's smoothing method
  • Zero-Allocation: Optimized for performance

Data Requirements:

Requires OHLC data with min (low), max (high), and previous close.

Calculation:

True Range = max(High - Low, |High - PrevClose|, |Low - PrevClose|)
ATR = Wilder's Smoothing of True Range over 14 periods

Interpretation:

  • High ATR = High volatility (trending market)
  • Low ATR = Low volatility (consolidation)
  • ATR does not indicate direction, only volatility
Since:
2026-01-01
Version:
1.0.0
Author:
Arber Gashi
  • Constructor Details

    • ATRRenderer

      public ATRRenderer()
  • 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