> ## Documentation Index
> Fetch the complete documentation index at: https://gocharting.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Volume across languages

> How Lipi maps to MQL4, MQL5, NinjaScript, Pine Script and thinkScript for volume: cumulative sum, negative volume index, on-balance volume, positive volume index, price-volume trend, volume-weighted average price and more, with the differences that matter when converting.

The built-in indicators computed from volume. Each row maps one concept from Lipi to the other languages; the word in a cell is the relation, explained in the [language map overview](https://gocharting.com/docs/scripting/reference/language-map.md#relations).

| Concept | Lipi | MQL4 | MQL5 | NinjaScript | Pine Script | thinkScript |
| - | - | - | - | - | - | - |
| [Cumulative sum](#ta-cum) | `ta.cum` | Absent | Caveat | Absent | Exact | Exact |
| [Negative volume index](#ta-nvi) | `ta.nvi` | Absent | Absent | Absent | Caveat | Caveat |
| [On-balance volume](#ta-obv) | `ta.obv` | Caveat | Caveat | Exact | Caveat | Exact |
| [Positive volume index](#ta-pvi) | `ta.pvi` | Absent | Absent | Absent | Caveat | Caveat |
| [Price-volume trend](#ta-pvt) | `ta.pvt` | Absent | Absent | Absent | Caveat | Caveat |
| [Volume-weighted average price](#ta-vwap) | `ta.vwap` | Absent | Absent | Caveat | Caveat | Caveat |
| [Williams variable accumulation/distribution](#ta-wvad) | `ta.wvad` | Absent | Absent | Absent | Caveat | Absent |

Each section below gives the Lipi construct first, then the construct in each language, with a note wherever behaviour differs. The language name links to the documentation the row was checked against.

## Cumulative sum

Accumulates `source` as the script advances through the chart.

In Lipi: `ta.cum`.

| Language | Construct | Relation | Note |
| - | - | - | - |
| [MQL4](https://docs.mql4.com/indicators) | | Not in MQL4 | No running-total function; keep a variable or array updated per bar. |
| [MQL5](https://www.mql5.com/en/docs/matrix/matrix_statistics) | `vector::CumSum` | Equivalent, with a caveat | Cumulative sum over a whole vector at once, not a running total carried from bar to bar. State and side effects: No state kept between calls; an incremental total needs a variable you maintain. |
| [NinjaScript](https://ninjatrader.com/support/helpGuides/nt8/indicators.htm) | | Not in NinjaScript | No running-total indicator (SUM is a rolling window); keep a Series\<double> or field and add each bar. |
| [Pine Script](https://www.tradingview.com/pine-script-reference/v6/#fun_ta.cum) | `ta.cum` | Exact | |
| [thinkScript](https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Math---Trig/TotalSum) | `TotalSum` | Exact | |

## Negative volume index

Negative volume index for the chart's bars.

In Lipi: `ta.nvi`.

| Language | Construct | Relation | Note |
| - | - | - | - |
| [MQL4](https://docs.mql4.com/indicators) | | Not in MQL4 | No negative volume index among the indicator functions. |
| [MQL5](https://www.mql5.com/en/docs/indicators) | | Not in MQL5 | No negative volume index among the built-in indicators. |
| [NinjaScript](https://ninjatrader.com/support/helpGuides/nt8/indicators.htm) | | Not in NinjaScript | No negative volume index in the system list; code it by hand. |
| [Pine Script](https://www.tradingview.com/pine-script-reference/v6/#var_ta.nvi) | `ta.nvi` | Equivalent, with a caveat | In Pine ta.nvi is a variable written without parentheses; Lipi exposes it as the function ta.nvi(). |
| [thinkScript](https://toslc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/M-N/NegativeVolumeIndex) | `NegativeVolumeIndex` | Equivalent, with a caveat | thinkScript starts the index at 100; Lipi's ta.nvi starts at 1.0, so the levels differ. |

## On-balance volume

On-balance volume for the chart's bars.

In Lipi: `ta.obv`.

| Language | Construct | Relation | Note |
| - | - | - | - |
| [MQL4](https://docs.mql4.com/indicators/iobv#iOBV) | `iOBV` | Equivalent, with a caveat | Takes an applied-price constant that Lipi's argument-free obv lacks. History indexing: shift counts bars back from the current bar; shift 0 is the still-forming bar, and any shift can be read in one call. Other timeframes: symbol and timeframe arguments read another symbol or period directly; Lipi ta calls use the chart's own bars. |
| [MQL5](https://www.mql5.com/en/docs/indicators/iobv) | `iOBV` | Equivalent, with a caveat | Takes an applied\_volume argument to choose the volume type; Lipi's call has no arguments. One buffer. State and side effects: Returns a handle; values are read later with CopyBuffer and are not ready right after creation. History indexing: CopyBuffer start\_pos 0 is the current bar and counts toward the past; copied data lands oldest-first. Other timeframes: Symbol and timeframe are explicit arguments, so another symbol or timeframe is requested directly. |
| [NinjaScript](https://ninjatrader.com/support/helpGuides/nt8/on_balance_volume_obv.htm) | `OBV` | Exact | |
| [Pine Script](https://www.tradingview.com/pine-script-reference/v6/#var_ta.obv) | `ta.obv` | Equivalent, with a caveat | In Pine ta.obv is a variable written without parentheses; Lipi exposes it as the function ta.obv(). |
| [thinkScript](https://toslc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/O-Q/OnBalanceVolume) | `OnBalanceVolume` | Exact | |

## Positive volume index

Positive volume index for the chart's bars, the counterpart of `talib.nvi`.

In Lipi: `ta.pvi`.

| Language | Construct | Relation | Note |
| - | - | - | - |
| [MQL4](https://docs.mql4.com/indicators) | | Not in MQL4 | No positive volume index among the indicator functions. |
| [MQL5](https://www.mql5.com/en/docs/indicators) | | Not in MQL5 | No positive volume index among the built-in indicators. |
| [NinjaScript](https://ninjatrader.com/support/helpGuides/nt8/indicators.htm) | | Not in NinjaScript | No positive volume index in the system list; code it by hand. |
| [Pine Script](https://www.tradingview.com/pine-script-reference/v6/#var_ta.pvi) | `ta.pvi` | Equivalent, with a caveat | In Pine ta.pvi is a variable written without parentheses; Lipi exposes it as the function ta.pvi(). |
| [thinkScript](https://toslc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/O-Q/PositiveVolumeIndex) | `PositiveVolumeIndex` | Equivalent, with a caveat | thinkScript starts the index at 100; Lipi's ta.pvi starts at 1.0, so the levels differ. |

## Price-volume trend

Price-volume trend for the chart's bars.

In Lipi: `ta.pvt`.

| Language | Construct | Relation | Note |
| - | - | - | - |
| [MQL4](https://docs.mql4.com/indicators) | | Not in MQL4 | No price-volume trend among the indicator functions. |
| [MQL5](https://www.mql5.com/en/docs/indicators) | | Not in MQL5 | No price-volume trend among the built-in indicators. |
| [NinjaScript](https://ninjatrader.com/support/helpGuides/nt8/indicators.htm) | | Not in NinjaScript | No price-volume trend in the system list; code it by hand. |
| [Pine Script](https://www.tradingview.com/pine-script-reference/v6/#var_ta.pvt) | `ta.pvt` | Equivalent, with a caveat | In Pine ta.pvt is a variable written without parentheses; Lipi exposes it as the function ta.pvt(). |
| [thinkScript](https://toslc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/O-Q/PriceAndVolumeTrend) | `PriceAndVolumeTrend` | Equivalent, with a caveat | thinkScript multiplies volume by the percent change of close; Lipi's ta.pvt uses the fractional change, so its values are 100 times smaller. |

## Volume-weighted average price

Volume-weighted average price built on `source`.

In Lipi: `ta.vwap`.

| Language | Construct | Relation | Note |
| - | - | - | - |
| [MQL4](https://docs.mql4.com/indicators) | | Not in MQL4 | No volume-weighted average price among the indicator functions. |
| [MQL5](https://www.mql5.com/en/docs/indicators) | | Not in MQL5 | No VWAP among the built-in indicators. |
| [NinjaScript](https://ninjatrader.com/support/helpGuides/nt8/order_flow_vwap2.htm) | `OrderFlowVWAP` | Equivalent, with a caveat | Needs a resolution, a trading-hours template that sets the reset point, and deviation settings; deviation bands are separate series. |
| [Pine Script](https://www.tradingview.com/pine-script-reference/v6/) | `ta.vwap` | Equivalent, with a caveat | Pine resets on an anchor condition (default daily) and has a bare hlc3 variable and band overload; Lipi's takes only source with no anchor argument. State and side effects: Pine's accumulation restarts on the anchor; Lipi offers no anchor control and its reset rule is undocumented. |
| [thinkScript](https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Fundamentals/vwap) | `vwap` | Equivalent, with a caveat | Takes an aggregation period (day, week, month) that sets the reset window, plus symbol and price type; Lipi ta.vwap has only a source. Other timeframes: The period argument can read another aggregation or symbol; Lipi cannot. |

## Williams variable accumulation/distribution

Williams variable accumulation/distribution, calculated on the chart's own bars.

In Lipi: `ta.wvad`.

| Language | Construct | Relation | Note |
| - | - | - | - |
| [MQL4](https://docs.mql4.com/indicators) | | Not in MQL4 | No Williams variable accumulation/distribution among the indicator functions. |
| [MQL5](https://www.mql5.com/en/docs/indicators) | | Not in MQL5 | No Williams variable accumulation/distribution among the built-in indicators (iAD and iBWMFI are different indicators). |
| [NinjaScript](https://ninjatrader.com/support/helpGuides/nt8/indicators.htm) | | Not in NinjaScript | No Williams variable accumulation/distribution in the system list; code it by hand. |
| [Pine Script](https://www.tradingview.com/pine-script-reference/v6/) | `ta.wvad` | Equivalent, with a caveat | Pine ta.wvad is a variable with no arguments; Lipi calls ta.wvad(length) and ignores length. Both give the per-bar (close-open)/(high-low)\*volume. |
| [thinkScript](https://toslc.thinkorswim.com/center/reference/Tech-Indicators/studies-library) | | Not in thinkScript | No Williams variable accumulation/distribution; WilliamsAD is the different Williams Accumulation/Distribution study. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.