Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.darvas.app/llms.txt

Use this file to discover all available pages before exploring further.

ta.vwap(price, volume) - Cumulative VWAP

Returns the volume-weighted average price from the first bar of the window to the current bar. Cumulative - it grows with each bar.
// overlay = true
plot("VWAP", null, { color: "#f59e0bFF", linewidth: 2 });

onBar(() => {
  plot("VWAP", ta.vwap(ctx.close, ctx.volume));
});
ta.vwap is cumulative over the entire loaded bar window, not anchored to session open. For session-anchored VWAP, reset manually using a Series and ta.cum.

ta.obv(close, volume) - On-Balance Volume

Running sum: adds volume on up bars, subtracts on down bars. Indicates whether volume is flowing into or out of an asset.
// overlay = false
plot("OBV", null, { color: "#22c55eFF" });

onBar(() => {
  plot("OBV", ta.obv(ctx.close, ctx.volume));
});

ta.accdist(close, high, low, volume) - Accumulation/Distribution

Weighted cumulative volume indicator. Uses the close location value (CLV) to determine how much of the volume was accumulation vs distribution.
plot("A/D", null, { color: "#3b82f6FF" });

onBar(() => {
  plot("A/D", ta.accdist(ctx.close, ctx.high, ctx.low, ctx.volume));
});

ta.mfi(high, low, close, volume, length) - Money Flow Index

Bounded 0-100 oscillator that combines price and volume. Often called “volume-weighted RSI”. Overbought > 80, oversold < 20.
// overlay = false
hline(80, { color: "#ef4444FF", style: "dashed" });
hline(20, { color: "#22c55eFF", style: "dashed" });
plot("MFI", null, { color: "#a78bfaFF" });

onBar(() => {
  plot("MFI", ta.mfi(ctx.high, ctx.low, ctx.close, ctx.volume, 14));
});

Volume trend analysis

Combining OBV with its own moving average to detect volume divergence:
plot("OBV",     null, { color: "#22c55eFF" });
plot("OBV SMA", null, { color: "#22c55e60" });

onBar(() => {
  const obv = ta.obv(ctx.close, ctx.volume);
  const obvSma = ta.sma(() => obv, 20);
  plot("OBV",     obv);
  plot("OBV SMA", obvSma);

  // OBV above its SMA = bullish volume trend
  bgcolor(obv > obvSma ? "#22c55e10" : "#ef444410");
});

Oscillators

RSI and MACD for non-volume oscillators.

Aggregators

ta.cum for custom cumulative calculations.

Bar context

ctx.volume source function.