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

    Function donchian

    • Donchian channel (Richard Donchian) — the highest high and lowest low of the trailing period bars, and their midpoint:

      upper  = max(high, period)      ${prefix}Upper
      lower = min(low, period) ${prefix}Lower
      middle = (upper + lower) / 2 ${prefix}Middle

      Appends three columns; each is undefined for the first period − 1 rows. Reads high and low (no close), each named by an option defaulting to its DEFAULT_OHLCV column.

      There is only one: upper is exactly what rollingMax gives over high and lower what rollingMin gives over low — this study is those two edges in one rolling scan (via highestLowestValues, the kernel it shares with stochastic and williamsR), plus the midpoint. Verified against pandas rolling(n).max() / .min() in the oracle fixture; TA-Lib has no Donchian to compare with.

      • In the units of the price, like atr: scaling every price scales the channel with it. It does not normalise.
      • A missing high or low is skipped, not propagated: the edge is the extreme of the cells the window does hold, and only a window with none reads undefined. This is core's reducer policy and the same contract rollingMax / rollingMin already ship — including over another study's output, where the channel starts on that study's first bar with whatever the window holds by then, rather than period − 1 bars later.
      • upper and lower bound close by construction only when low ≤ close ≤ high holds on the input bars; the study does not check that, and a close outside its own bar's range will sit outside the channel too.

      Type Parameters

      • S extends SeriesSchema
      • const Prefix extends string = "dc"

      Parameters

      Returns TimeSeries<
          readonly [
              S[0],
              ValueColumnsForSchema<
                  readonly [
                      S[0],
                      ValueColumnsForSchema<
                          readonly [
                              S[0],
                              ValueColumnsForSchema<S>,
                              OptionalNumberColumn<`${Prefix}Upper`>,
                          ],
                      >,
                      OptionalNumberColumn<`${Prefix}Lower`>,
                  ],
              >,
              OptionalNumberColumn<`${Prefix}Middle`>,
          ],
      >