@pond-ts/financial API Reference
    Preparing search index...

    Function disparityIndex

    • Disparity Index (Steve Nison) — how far the price sits from its own moving average, as a percentage of that average:

      100 · (price − MA(period)) / MA(period)
      

      Zero means price is exactly on the average; +3 means 3% above it. The average comes from the shared K2 engine, so maType is the whole MaType menu.

      TA-Lib has no Disparity Index, so this is a pandas replication of the definition above (assessment §6.1: 100·(C−MA)/MA, MA-type), with the analytic first-valid bar asserted in the oracle generator rather than a vendor mask copied. The formula is unambiguous across sources — the only convention worth naming is that it is a percent (×100), not a ratio, which is what every published version plots.

      It is the percent sibling of movingAverageDeviation, which is the same numerator in price units (price − MA). The two ship as separate studies rather than one with a mode flag — that would be two indicators behind an option, the keltner precedent this package avoids — and the identity 100·maDev/MA === disparity is asserted in the oracle so they cannot drift. (An earlier version of this note declined the absolute form as "momentum-shaped arithmetic anyone can write"; that was wrong on the detail — momentum subtracts a lagged price, not a smoothed one — and the corpus names it as a study of its own.)

      Same shape, different fast leg: the price oscillator's numerator is MA(fast) − MA(slow), this one's is price − MA. Setting a price oscillator's fastPeriod to 1 does not reproduce it in general (an MA(1) is the price only for the window types), so the two stay separate studies rather than one with a magic period.

      • Warm-up is the average's, per the K2 engine's table — bar period − 1 for the window types and ema, later for dema / tema / hull / kama / zlema. Length-preserving; earlier rows undefined.
      • Scale-invariant: multiplying every price by k multiplies both the numerator and the denominator, so the reading is unchanged (pinned by a property test). It is not shift-invariant — adding a constant moves the denominator without moving the numerator.
      • A leading gap shifts the start for every maType except 'sma', which keeps sma()'s row-counting window (the column door's documented asymmetry).
      • An interior gap costs whatever the chosen maType costs — window types recover once it leaves the window, the ema family skips the bar, smma and kama propagate to the end (stated per type on movingAverageValues). The bar's own missing price also costs that bar's numerator, so the reading is missing there regardless of the type.
      • A zero moving average (reachable only on a column that can be zero or negative — a return series, another oscillator) reports no value, not Infinity and not 0: the ratio is genuinely undefined there.

      Type Parameters

      • S extends SeriesSchema
      • const Output extends string = "disparity"

      Parameters

      Returns TimeSeries<
          readonly [S[0], ValueColumnsForSchema<S>, OptionalNumberColumn<Output>],
      >