Kumo Charts

@kumo-charts/core/indicators

API 参考由源码注释生成,只有英文。

import { … } from '@kumo-charts/core/indicators';

Functions

checkIndicatorInputfunction源码

function checkIndicatorInput(definition: IndicatorRules, input: IndicatorInput): void

Checks an indicator against its type as chart.indicators.add() does, without a chart: the parameters and the outputs and shades they make, the source, the timeframe, the colors and styles by output key and the reference lines. Throws the ChartError that add() would, e.g. on what a user typed into a settings form, before keeping it. definition is the type's, such as MACD of @kumo-charts/core/indicators or one of chart.indicators.definition(). What needs the chart is left to add(): the pane, the indicator a source reads and its timeframe, a free id.

computeIndicatorfunction源码

function computeIndicator<P extends ParamValues>(
  definition: IndicatorDefinition<P>,
  bars: readonly BarInput[],
  options: IndicatorCalculatorOptions = {}
): Record<string, number[]>

Computes an indicator over bars, in strictly ascending time as a chart takes them: one array per output key, with a value for every bar.

createIndicatorCalculatorfunction源码

function createIndicatorCalculator<P extends ParamValues>(
  definition: IndicatorDefinition<P>,
  options: IndicatorCalculatorOptions = {}
): IndicatorCalculator

Starts computing an indicator of a definition without a chart, such as MACD. Runs anywhere, Node and workers included; the values equal those of a chart with the same bars, parameters, source, calendar and interval.

indicatorLanguagefunction源码

function indicatorLanguage(
  texts: readonly IndicatorTexts[],
  locale: string | null
): IndicatorLanguage

The words of indicators in the language of locale, the runtime's for null, as a chart gives them with the texts given to its module: for a form of settings without a chart.

indicatorsfunction源码

function indicators(
  definitions: readonly IndicatorDefinition[] = [],
  options: IndicatorsModuleOptions = {}
): IndicatorsModule

The indicators module: chart.indicators, with the indicator types given, such as indicators(allIndicators) or indicators([MA, MACD, RSI]). Other types can be registered with chart.indicators.register().

movingAveragefunction源码

function movingAverage(kind: AverageKind, period: number): BarStep

A moving average of the latest period values, as the indicators of the library pick them: NaN until period values came, and a NaN skipped, the average left as it was. The EMA and the RMA start from the simple average of their first period values; the volume-weighted one weighs each value by the volume of its bar.

sessionsIndicatorfunction源码

function sessionsIndicator(
  sessions: readonly SessionRange[],
  type = 'SESSIONS'
): IndicatorDefinition<Record<string, never>>

Trading sessions, such as those of Tokyo, London and New York: a box over the bars that start inside each session, from its low to its high. The values on a bar are the session's high and low so far, so the box of the session in progress grows with it; each session follows its own time zone, daylight saving included. SESSIONS is the type of DEFAULT_SESSIONS; give other sessions a type of their own to have both.

Classes

Previousclass源码

class Previous

Remembers the previous value of a series.

next(value: number): number

Returns the value from the previous call, then stores value.

clone(): Previous

RingBufferclass源码

class RingBuffer

The latest capacity values, oldest first, as a calculator keeps a window of them.

constructor(readonly capacity: number)
get length(): number

How many values it holds, up to capacity.

get full(): boolean

Whether it holds capacity values.

push(value: number): number

Appends a value and returns the one it evicted, or NaN.

at(index: number): number

Value index places from the oldest (0 = oldest).

fromEnd(back: number): number

Value back places from the newest (0 = newest).

max(): number

The highest value held; -Infinity without any.

min(): number

The lowest value held; Infinity without any.

sum(): number

The sum of the values held.

clone(): RingBuffer

RollingExtremesclass源码

class RollingExtremes

Highest high and lowest low of the latest period bars, as of channels and stochastics; NaN until period bars were added.

constructor(period: number)
push(high: number, low: number): void

Adds the high and the low of the next bar.

highest(): number
lowest(): number

StandardDeviationclass源码

class StandardDeviation

Population standard deviation of the latest period values that are numbers, NaN until period values came: a NaN is skipped and leaves the deviation as it was.

constructor(private readonly period: number)
next(input: number): number

Interfaces

BarStepinterface源码

interface BarStep

A calculation fed a value and its bar, bar by bar, such as a moving average, which a volume weighs; clone() copies its state, as a calculator copies its own.

next(value: number, bar: Bar): number

Takes the value of the next bar and returns what it computes, NaN while it warms up.

clone(): BarStep

BarWindowinterface源码

interface BarWindow

A window of the most recent bars, oldest first.

readonly length: number
bar(index: number): Bar
price(index: number): number

Indicatorinterface源码

interface Indicator
readonly id: string
readonly type: string
readonly params: ParamValues
readonly pane: string
readonly scale: string
readonly source: PriceSource | Readonly<IndicatorReference>
readonly timeframe: string | null

The timeframe it is computed in, such as 1h, that of the indicator it reads too; null for the chart's bars.

readonly visible: boolean
readonly lastValueLabel: boolean

Its latest values are marked on the price axis.

readonly colors: Readonly<Record<string, string>>
readonly styles: Readonly<Record<string, Readonly<IndicatorOutputStyle>>>
readonly levels: readonly number[] | null

The reference lines set in place of the type's, or null for the type's.

IndicatorCalculatorinterface源码

interface IndicatorCalculator

An indicator computed without a chart: it consumes bars one by one and returns the values a chart computes on them.

readonly params: ParamValues

The parameters, defaults included.

readonly source: PriceSource
readonly outputs: readonly IndicatorOutput[]

What each value is, in the order next() returns them.

readonly levels: readonly number[]

The type's reference lines for these parameters.

next(bar: BarInput): number[]

Consumes the next bar and returns one value per output, NaN where there is none (warm-up, division by zero). Values are those computed on the bar: an output with an offset is drawn that many bars later on a chart. Throws on a bar no later than the last one, which would be counted twice; clone() tries a bar both ways.

nextOf(bar: BarInput, value: number): number[]

Consumes the next bar as a chart computes an indicator whose source is another one: value, the other's on the bar, as every price, the bar giving its time and volume. A NaN value, as the other warms up, skips the bar as the chart skips it: its values are NaN.

An independent copy that continues from here, e.g. to try the next bar both ways.

IndicatorCalculatorOptionsinterface源码

interface IndicatorCalculatorOptions
params?: ParamValues

Overrides of the parameter defaults, as chart.indicators.add() takes them.

source?: PriceSource

Price passed to the calculation; the type's default, close unless it sets another.

calendar?: Calendar

The trading calendar of indicators that follow trading days, such as VWAP and the relative volume at time: the chart's calendar option made with createCalendar(). Default createCalendar(), the local zone.

interval?: IntervalInput | null

The interval of the bars, as a chart has it: its timeframe, or the source interval. Indicators that follow it, such as the pivot points left to Auto and the historical volatility, which it annualizes, take it; null (default) for bars without one.

IndicatorContextinterface源码

interface IndicatorContext

What a calculator knows beyond the bars. The chart computes its indicators again when the calendar or the interval changes.

readonly calendar: Calendar

The chart's trading calendar (the calendar option): calendar.bucket(bar.time, '1D') is the start of the trading day of a bar, '1W' of its week, '1M' of its month.

readonly interval: Interval | null

The interval of the bars: the indicator's timeframe while it is computed in it, else the chart's timeframe, or the source interval when it shows the source bars; null for bars given without one. Bars a transform builds, such as Renko bricks, have the interval of the bars they are built from.

readonly symbol?: string | null

The symbol of the bars, where the page that made the chart says it: an indicator that reads data besides the bars, such as another source of the same symbol, needs to know it. null where the page does not say.

IndicatorDefinitionBaseinterface源码

interface IndicatorDefinitionBase<P extends ParamValues>

What every indicator type has, whichever way it computes its values.

readonly type: string

The type indicators of it are added by, such as MACD.

readonly name: string

Display name, such as MACD or Ichimoku.

readonly pane: 'main' | 'new'

Overlays share the main pane; oscillators get a pane of their own by default.

readonly source?: PriceSource

Price the calculator receives when the indicator names no source. Default close.

readonly params: { readonly [K in keyof P]: ParamSpec }
outputs(params: P): readonly IndicatorOutput[]
levels?(params: P): readonly number[]

Horizontal reference lines, such as RSI 30/70.

fills?(params: P): readonly IndicatorFill[]

Shades between outputs the parameters make, such as the bands they turn on.

readonly precision: number | 'price' | 'volume'

Decimals of the values, price to follow the main series precision, or volume for values of any size in few characters, such as 1.25M, 0.00412 or 4.12E-10.

readonly range?: { readonly min: number; readonly max: number }

Fixed scale range of the pane, such as 0..100 for RSI.

IndicatorFillinterface源码

interface IndicatorFill

Shades the area between two outputs where both are drawn, such as Bollinger Bands; a hidden output bounds a shade too. Between two segments outputs the area steps with them, bar by bar.

readonly from: string
readonly to: string
readonly colorBy?: 'from' | 'higher'

from (default) shades the area in the color of from; higher in the color of whichever output is higher, split exactly where the lines cross, such as the Ichimoku cloud.

IndicatorInputinterface源码

interface IndicatorInput
id?: string

Generated when omitted.

type: string
params?: ParamValues

Overrides of the definition's parameter defaults.

pane?: string

main, new (a pane of its own) or the id of an existing pane.

scale?: string

Price scale in the pane: right (default), left, or any other name for an overlay scale of its own, e.g. volume at the bottom of the main pane.

Price passed to the calculator, close unless the type sets another default (hlc3 for VWAP), or another indicator's output. Fed by an indicator, the calculator sees its value as open, high, low and close, and skips bars where it has none.

timeframe?: IntervalInput | null

The timeframe it is computed in, longer than the chart's, such as '1h' on 5-minute bars: on bars of it built from the chart's source bars with the trading calendar, as the chart builds its own timeframe. Each displayed bar shows the value of the latest bar of the timeframe closed by its end, so no bar shows what was not known by then, and the latest one shows the bar still forming. While the chart's bars cannot show it, as on a timeframe as long or longer, one their source cannot build, or bars a transform builds without time such as Renko bricks, it is computed on the chart's bars, and back on its own when they can. Lengths compare nominally: seconds, minutes and hours as they are, a day as 24 hours, a week as 7 days and a month as 30. An indicator reading another is computed in that one's timeframe, which one given must be. null (default): on the chart's bars.

visible?: boolean
lastValueLabel?: boolean

Marks the latest value of each of its lines and histograms on the price axis, in their colors, as the latest price is. Default false.

colors?: Record<string, string>

Color overrides keyed by output key.

styles?: Record<string, IndicatorOutputStyle>

How outputs are drawn, keyed by output key: shown or not, the width and style of lines.

levels?: readonly number[]

Reference lines in place of the type's, such as RSI 30 and 70; [] draws none.

IndicatorLanguageinterface源码

interface IndicatorLanguage

The words of indicators in the language of a chart.

label(text: string): string

A word of the definitions in the language, or itself without one.

title(type: string): string | null

The full name of a type in the language, else in English, else null.

IndicatorOutputinterface源码

interface IndicatorOutput
readonly key: string
readonly label: string
readonly plot: IndicatorPlot
readonly color?: string

Fixed color. Lines without one take theme palette colors in order.

readonly themeColor?: 'up' | 'down'

Takes the theme's up or down color unless a fixed color is set, e.g. for an uptrend.

readonly offset?: number

Whole bars to shift the plot by: the value computed on bar i is drawn on bar i + offset, to the right when positive (past the latest bar, such as the leading spans of Ichimoku) and to the left when negative; bars of the indicator's timeframe when it has one. The legend, valuesAt(), alerts and barColor read the value drawn on a bar. Default 0.

readonly legend?: boolean

Shows the value in the legend. Default true; turn it off for values that only place a drawing, such as where columns start or where a marker sits.

readonly precision?: number

Decimals of this output in the legend and valuesAt(), in place of the indicator's precision, e.g. for a percentage among prices.

readonly autoscale?: boolean

Takes part in fitting the price scale to what is in view. Default true; false for levels that can lie far from the price, such as the outer pivot points, which would squash the bars: they are drawn where they are and may leave the plot. A scale with nothing else to fit fits them all the same.

IndicatorOutputStyleinterface源码

interface IndicatorOutputStyle

How an output of an indicator is drawn, over what its type sets.

visible?: boolean

Drawn and shown in the legend. Default true.

lineWidth?: number

Width of a line in CSS pixels, from 0.5 to 10. Default: the plot's width, else 1.25.

lineStyle?: LineStyle

Style of a line, in place of the type's.

autoscale?: boolean

Takes part in fitting the price scale, in place of the output's autoscale.

IndicatorPatchinterface源码

interface IndicatorPatch

Changes of an indicator. Colors and styles change by output key, null restoring the type's; those of outputs that new parameters no longer produce, such as ma5 after periods: [7], go. levels: null restores the type's reference lines.

params?: ParamValues
pane?: string

Moves the indicator: to main, to new (a pane of its own, on its right scale unless scale names another) or to an existing pane by id. A pane made for it goes with the last thing in it.

timeframe?: IntervalInput | null

The timeframe it is computed in; null for the chart's bars.

visible?: boolean
lastValueLabel?: boolean
scale?: string
colors?: Record<string, string | null>
styles?: Record<string, IndicatorOutputStyle | null>
levels?: readonly number[] | null

IndicatorReferenceinterface源码

interface IndicatorReference

Another indicator's output used as the input of an indicator, e.g. a moving average of RSI. Its values are read by the bar they are computed on, and the reading indicator is drawn shifted by the same offset.

kind: 'indicator'
id: string
key?: string

Output key. Without it the indicator reads the first output, whatever it is named, so it keeps working when the upstream parameters (and so its keys, such as rsi6) change.

IndicatorsApiinterface源码

interface IndicatorsApi
set(indicators: readonly IndicatorInput[]): void

Replaces every indicator, in order: one may read an indicator before it. What reads an indicator, such as an alert, must find it among them. An invalid input throws and changes nothing.

add(indicator: IndicatorInput): string

Adds an indicator and returns its id: the one it has, or one the chart numbers for it.

update(id: string, patch: IndicatorPatch): void

Changes an indicator. Colors and styles change by output key, null restoring the type's; levels: null restores the type's reference lines.

remove(id: string): void

Throws for an unknown id, and while something, such as an alert, reads the indicator.

clear(): void

Removes every indicator; throws while something, such as an alert, reads one.

get(id: string): Indicator | null

The indicator of an id, or null.

list(): Indicator[]
valuesAt(id: string, index?: number): IndicatorValue[]

Values of every output drawn on bar index (default: the latest bar). Shifted outputs give the value computed offset bars earlier, and are drawn beyond the bars too: index may lie before the first bar or after the latest one. An indicator of a timeframe of its own gives what the bar shows: the value of the latest bar of the timeframe closed by its end, of the one still forming on the latest bar.

refresh(id: string, from?: number): void

Computes an indicator again from the bar holding time from on, with the indicators reading it: for a calculator that reads data besides the bars, such as trades or funding rates it fetches, which is to be called whenever that data changes, as the chart cannot tell. From the latest bar, only that bar is computed again, as for a tick; from an earlier one, or without from, the whole indicator is. Throws for an unknown id.

register<P extends ParamValues>(definition: IndicatorDefinition<P>): void

Adds an indicator type to this chart, named by its type.

unregister(type: string): void

Removes an indicator type. Fails while indicators of it are on the chart.

types(): string[]

Every indicator type the chart has.

definition(type: string): Readonly<IndicatorDefinition> | null

The definition of a type, or null for an unknown type: its parameters, outputs and reference lines, for a form of its settings.

title(type: string): string | null

The full name of a type in the chart's language, from the texts given to the module, such as Moving average for MA; null without one.

label(text: string): string

A word of the definitions, such as the label of an output, a parameter or an option, in the chart's language, from the texts given to the module; the word itself without one.

IndicatorsModuleOptionsinterface源码

interface IndicatorsModuleOptions

What indicators() takes beside the types.

readonly texts?: readonly IndicatorTexts[]

The words of the indicators in other languages, such as the indicatorTexts of the library's types; those given later win. The legend and valuesAt() follow the chart's locale.

IndicatorStreaminterface源码

interface IndicatorStream

Incremental calculator. next() consumes one bar and returns one value per output (NaN while warming up). The engine may call clone() to keep a checkpoint, so every state must be copied.

bar is reused between calls and must not be retained; price is the configured source price.

next(bar: Bar, price: number): ArrayLike<number>

IndicatorValueinterface源码

interface IndicatorValue
readonly key: string
readonly label: string

The output's label in the chart's language, as the legend writes it.

readonly color: string

The color the value is drawn in on the bar, as the legend shows it.

readonly value: number | null

null where the output has none on the bar, as other single values of the chart are; the calculators, which give a value per bar, give NaN there.

readonly text: string

Formatted with the indicator precision.

IndicatorWordsinterface源码

interface IndicatorWords

The words of indicators in one language, by the English their definitions are written in.

readonly names?: Readonly<Record<string, string>>

The full names of indicator types, such as Moving average for MA.

readonly labels?: Readonly<Record<string, string>>

The words of the definitions: the names, and the labels of outputs, parameters and their options, such as 上轨 for Upper. One ending in a number, as Upper Band #2, takes the words of Upper Band #{n} with its number.

ParamOptioninterface源码

interface ParamOption

One of the values a parameter takes, and its name.

readonly value: number
readonly label: string

ParamSpecinterface源码

interface ParamSpec

Constraints of a numeric parameter. Array defaults accept up to 8 values, such as MA periods, at least one unless the default is empty, such as the volume's averages.

default: number | readonly number[]
min?: number
max?: number
integer?: boolean
label?: string

Shown in the legend and in parameter UIs. Defaults to the parameter key.

options?: readonly ParamOption[]

The only values the parameter takes, each named: the legend shows the name instead of the number, and a parameter UI can offer the names as a select. E.g. the VWAP anchor.

legend?: boolean

Shows the value in the legend after the indicator's name. Default true; false for settings that need no mention there, such as the type of a smoothing average.

SavedIndicatorinterface源码

interface SavedIndicator

An indicator as a chart state keeps it.

readonly id: string
readonly type: string
readonly params: ParamValues
readonly pane: string
readonly scale?: string

Price scale in the pane; right when absent.

readonly source: PriceSource | Readonly<IndicatorReference>
readonly timeframe?: string

The timeframe it is computed in, such as 1h; absent for the chart's bars.

readonly visible: boolean
readonly lastValueLabel?: boolean

Its latest values are marked on the price axis; absent for not.

readonly colors: Readonly<Record<string, string>>
readonly styles?: Readonly<Record<string, IndicatorOutputStyle>>
readonly levels?: readonly number[]

Reference lines in place of the type's; absent for the type's.

SessionRangeinterface源码

interface SessionRange

A trading session whose range sessionsIndicator draws.

key: string

Starts the keys of its outputs, ${key}High, ${key}Low and ${key}Day (the trading day of the session, as a time), e.g. london.

label: string

Names it in the legend, e.g. London.

session: string

'HH:MM-HH:MM' in timeZone; an end before the start crosses midnight.

timeZone: string

IANA zone of the session's times, such as Europe/London.

ZigzagLabelsinterface源码

interface ZigzagLabels

What the labels of a zigzag write by each pivot, in the theme's up color over a high and in its down color under a low: on the first line its price and its change from the pivot before, on the second the volume of the bars after that pivot through this one (from the first bar for the first pivot). The end of an extended line has its label too.

readonly price?: boolean

The price, as the indicator formats its values.

readonly change?: 'absolute' | 'percent' | null

The change from the pivot before, in parentheses, signed: as a price (absolute) or in percent of the pivot before (percent); null (default) for none. The first pivot has none before it: its change is 0.

readonly volume?: boolean

The volume, in few characters such as 1.25M.

Types

AverageKindtype源码

type AverageKind = 'sma' | 'ema' | 'rma' | 'wma' | 'vwma'

The moving averages of movingAverage: simple, exponential, Wilder's (RMA, also SMMA), linearly weighted and volume-weighted.

IndicatorDefinitiontype源码

type IndicatorDefinition<P extends ParamValues = ParamValues> = IndicatorDefinitionBase<P> &
  (
    | { create(params: P, context: IndicatorContext): IndicatorStream }
    | {
        lookback(params: P): number;
        compute(window: BarWindow, params: P, context: IndicatorContext): ArrayLike<number>;
      }
  )

An indicator type. Implement either create() for full incremental control, or lookback and compute() to derive each value from the latest bars only.

IndicatorPlottype源码

type IndicatorPlot =
  /** A polyline, `width` CSS pixels wide (0.5 to 10, default 1.25) unless the user sets one. */
  | { readonly kind: 'line'; readonly style?: LineStyle; readonly width?: number }
  /**
   * A horizontal line through each run of bars with the same value, from the left edge of the
   * run's first bar to the right edge of its last; a new value starts a new line. For levels that
   * hold over a period, such as the pivot points of a trading day.
   */
  | { readonly kind: 'segments'; readonly style?: LineStyle; readonly width?: number }
  /**
   * A box over each run of consecutive bars with values, from the lowest value of output `from`
   * to the highest of this one in the run, shaded and outlined in this output's color: the range
   * of a session from its high and low so far, which grows with the latest run.
   */
  | {
      readonly kind: 'box';
      /** The key of the output the boxes reach down to. */
      readonly from: string;
      /**
       * The key of an output whose value tells the boxes apart, such as the start of a session:
       * a bar where it changes starts a new box, also right after the last one.
       */
      readonly group?: string;
    }
  /**
   * Columns from zero in the theme's up and down colors by the sign of the value (down below 0),
   * its change (down where it fell or stayed, up where it rose and on the first value), or the bar
   * direction; all in the color of the output when it has one, fixed or set.
   */
  | { readonly kind: 'histogram'; readonly colorBy: 'sign' | 'change' | 'bar' }
  /**
   * Columns in the output's color from another output's value, or from a fixed value, to this
   * one, on the bars where both are defined: candle-like bodies or highlighted bars.
   */
  | {
      readonly kind: 'columns';
      /** The key of the output the columns start at, or a value such as `0`. */
      readonly from: string | number;
      /** Width as a share of the bar spacing, from 0 to 1. Default `0.6`. */
      readonly width?: number;
      /** Draws the outline only. */
      readonly hollow?: boolean;
    }
  /**
   * A candle on each bar where this output and the outputs `open`, `high` and `low` all have
   * values, this one its close: a body from the open to the close and a wick from the low to the
   * high, as the main series draws candles. It takes the theme's up color where it closes at or
   * above its open and the down color otherwise, or the output's color on every candle when it
   * has one, fixed or set; the legend writes the values of the four in the color of the candle.
   * The other three are usually `hidden`, which shows their values in the legend. The price scale
   * fits the highs and lows.
   */
  | {
      readonly kind: 'candles';
      /** The keys of the outputs that give each candle its open, high and low. */
      readonly open: string;
      readonly high: string;
      readonly low: string;
    }
  /**
   * A shape, a text or both at the value, on the bars where it is defined: signals such as an
   * arrow under the bar a crossing happens on. Upward shapes point up at the value from below
   * and downward shapes down at it from above; circles and squares sit on it. Text goes beyond
   * the shape, or on the value without one. Without a color, arrows and triangles take the
   * theme's buy and sell colors.
   */
  | {
      readonly kind: 'marker';
      readonly shape?: MarkerShape;
      readonly text?: string;
      /**
       * Writes the value too, as the legend formats it, after the text if there is one: the price
       * of a pivot, say. Default `false`.
       */
      readonly value?: boolean;
      /** Half the width of the shape in CSS pixels, as for chart markers. Default `5`. */
      readonly size?: number;
    }
  /**
   * A zigzag through pivots, such as the swings of the price: the values of output `high` are its
   * highs and those of output `low` its lows, each drawn on its bar. Taken in the order of their
   * bars, a high before a low on the same bar, each run of highs (or of lows) gives the line one
   * pivot, the last of the run: a pivot replaces the one before it until one of the other side
   * comes. So the values are those known on each bar, never changed later, and the line moves its
   * last pivot as later values come.
   */
  | {
      readonly kind: 'zigzag';
      /** The key of the output of the highs. */
      readonly high: string;
      /** The key of the output of the lows. */
      readonly low: string;
      /** Draws on from the last pivot to this output's value on the latest bar. Default `false`. */
      readonly extend?: boolean;
      /** Writes by each pivot, over a high and under a low, what is picked. Default: nothing. */
      readonly labels?: ZigzagLabels;
      readonly style?: LineStyle;
      /** Width in CSS pixels, from 0.5 to 10, default 1.25, unless the user sets one. */
      readonly width?: number;
    }
  /** Not drawn; only shown in the legend and available to alerts. */
  | { readonly kind: 'hidden' }

IndicatorRulestype源码

type IndicatorRules = Pick<IndicatorDefinition, 'type' | 'params' | 'outputs' | 'fills'> & {
  lookback?(params: ParamValues): number;
}

What of an indicator type its settings are checked against: its shades and its window too, if it has them.

IndicatorsModuletype源码

type IndicatorsModule = ChartModule<{
  readonly api: { readonly indicators: IndicatorsApi };
  readonly state: { readonly indicators: readonly SavedIndicator[] };
}>

IndicatorTextstype源码

type IndicatorTexts = Readonly<Record<string, IndicatorWords>>

The words of indicators by language, the first subtag of a locale: en, zh, ja, ko, … As indicators(allIndicators, { texts: [indicatorTexts] }) takes them.

ParamValuestype源码

type ParamValues = Record<string, number | readonly number[]>

RibbonParamstype源码

type RibbonParams = {
  maType1: number;
  period1: number;
  maType2: number;
  period2: number;
  maType3: number;
  period3: number;
  maType4: number;
  period4: number;
}

Parameters of a moving average ribbon: the type and length of each of its four averages.

SmoothingParamstype源码

type SmoothingParams = {
  maType: number;
  maLength: number;
  bbMult: number;
}

The parameters of a moving average of an oscillator, with Bollinger Bands around it.

VwapParamstype源码

type VwapParams = {
  anchor: number;
  bandMode: number;
  band1: number;
  band2: number;
  band3: number;
}

The parameters of VWAP.

ZigzagParamstype源码

type ZigzagParams = {
  deviation: number;
  depth: number;
  extend: number;
  showPrice: number;
  showVolume: number;
  showChange: number;
  changeMode: number;
}

The parameters of the zigzag.

Variables

const AD: IndicatorDefinition<Record<string, never>>

Accumulation/distribution: the running total, from the first bar, of each bar's volume weighted by where its close lies in its range, (2C - L - H) / (H - L) * V; a bar without range adds 0.

ADRvariable源码

const ADR: IndicatorDefinition<{ period: number }>

Average daily range: the simple average of the high-to-low range of the last period bars.

ALLIGATORvariable源码

const ALLIGATOR: IndicatorDefinition<{
  jaw: number;
  teeth: number;
  lips: number;
  jawShift: number;
  teethShift: number;
  lipsShift: number;
}>

Bill Williams' Alligator: smoothed moving averages of the median price (H + L) / 2, seeded with their simple average, the jaw drawn 8 bars ahead, the teeth 5 and the lips 3.

allIndicatorsvariable源码

const allIndicators: readonly IndicatorDefinition[]

Every indicator type of the library, for indicators(allIndicators). Listed one by one, so that an application picking a few ships only those.

ALMAvariable源码

const ALMA: IndicatorDefinition<{ period: number; offset: number; sigma: number }>

AOvariable源码

const AO: IndicatorDefinition<{ fast: number; slow: number }>

Awesome oscillator: the simple average of 5 median prices (H + L) / 2 minus that of 34, from bar slow - 1, in columns in the theme's up color where it rose from the bar before (and on the first) and in its down color where it fell or stayed.

AROONvariable源码

const AROON: IndicatorDefinition<{ period: number }>

ASIvariable源码

const ASI: IndicatorDefinition<{ period: number; signal: number }>

振动升降指标 (accumulative swing index), as in Chinese charting software. Against the previous close LC, low and open: AA = |H - LC|, BB = |L - LC|, CC = |H - REF(L, 1)|, DD = |LC - REF(O, 1)|; R = AA + BB / 2 + DD / 4 where AA is the largest of AA, BB and CC, BB + AA / 2 + DD / 4 where BB is, else CC + DD / 4; X = C - LC + (C - O) / 2 + LC - REF(O, 1) and SI = 16 * X / R * MAX(AA, BB). ASI = SUM(SI, M1) and ASIT = MA(ASI, M2). The first bar has no swing, so ASI starts on bar M1 and ASIT M2 - 1 bars later. A bar where R is 0, as where neither it nor the one before moved, swings 0: flat bars, common on short timeframes without trades, would otherwise leave ASI without values for M1 bars.

ATRvariable源码

const ATR: IndicatorDefinition<{ period: number; smoothing: number }>

Average true range: a moving average of the true range of period bars, Wilder's smoothing (RMA) by default; the first bar's range is its high minus its low.

BBIvariable源码

const BBI: IndicatorDefinition<{ n1: number; n2: number; n3: number; n4: number }>

多空指标 (bull and bear index), as in Chinese charting software: (MA(N1) + MA(N2) + MA(N3) + MA(N4)) / 4.

BBPvariable源码

const BBP: IndicatorDefinition<BandParams>

Bollinger Bands %B: where the price lies within the Bollinger Bands, period bars and multiplier population standard deviations wide, (price - lower) / (upper - lower): 0 at the lower band, 1 at the upper one, beyond them outside the bands; undefined while they meet.

BBWvariable源码

const BBW: IndicatorDefinition<BandParams & { expansion: number; contraction: number }>

Bollinger BandWidth: the distance between the Bollinger Bands, period bars and multiplier population standard deviations wide, in percent of their basis, the simple average: (upper - lower) / basis * 100. The highest expansion is its highest value of the last expansion bars and the lowest contraction its lowest of the last contraction bars, both once that many bars have one.

BIASvariable源码

const BIAS: IndicatorDefinition<{ periods: readonly number[] }>

BOLLvariable源码

const BOLL: IndicatorDefinition<{ period: number; maType: number; multiplier: number }>

Bollinger Bands: a moving average of the price, SMA by default, and bands multiplier population standard deviations of the price over the same length above and below it.

BOPvariable源码

const BOP: IndicatorDefinition<Record<string, never>>

Balance of power: (C - O) / (H - L) of each bar, undefined on a bar without range.

BRARvariable源码

const BRAR: IndicatorDefinition<{ period: number }>

CCIvariable源码

const CCI: IndicatorDefinition<{ period: number } & SmoothingParams>

Commodity channel index of the typical price (H + L + C) / 3 by default, and a moving average of it, an SMA of 14 values by default, with Bollinger Bands around it if picked.

CHAIKINOSCvariable源码

const CHAIKINOSC: IndicatorDefinition<{ fast: number; slow: number }>

Chaikin oscillator: the EMA of fast bars of the accumulation/distribution line minus its EMA of slow bars, each seeded with the simple average of its first values, so it starts on bar max(fast, slow) - 1.

CHANDELIERvariable源码

const CHANDELIER: IndicatorDefinition<{
  period: number;
  atrPeriod: number;
  multiplier: number;
}>

Chuck LeBeau's chandelier exit: the long exit hangs multiplier ATRs of atrPeriod bars under the highest high of period bars, and the short exit as far above the lowest low.

CHOPvariable源码

const CHOP: IndicatorDefinition<{ period: number }>

CKSTOPvariable源码

const CKSTOP: IndicatorDefinition<{
  period: number;
  multiplier: number;
  stopPeriod: number;
}>

Chande Kroll stop: the first stops hang multiplier ATRs of period bars (Wilder's, seeded with the mean of the first true ranges) under the highest high of period bars and above the lowest low; the long stop is the lowest of the first low stops over stopPeriod bars, the short stop the highest of the first high stops. Both start on bar period + stopPeriod - 2.

CMFvariable源码

const CMF: IndicatorDefinition<{ period: number }>

CMOvariable源码

const CMO: IndicatorDefinition<{ period: number }>

Chande momentum oscillator: the sum of the rises of the price over period bars minus the sum of its falls, in percent of their total, from bar period; undefined while the price stays.

COPPOCKvariable源码

const COPPOCK: IndicatorDefinition<{
  wmaLength: number;
  longRoc: number;
  shortRoc: number;
}>

Coppock curve: the linearly weighted average over 10 bars of the sum of the rates of change of the price over 14 and 11 bars, from bar longRoc + wmaLength - 1.

CRvariable源码

const CR: IndicatorDefinition<{ period: number; periods: readonly number[] }>

能量指标 (CR, also 中间意愿指标), as in Chinese charting software: against the middle of the previous bar MID = REF(H + L, 1) / 2, CR = SUM(MAX(0, H - MID), N) / SUM(MAX(0, MID - L), N) * 100, from bar N, undefined while nothing went below the middles. Each average is REF(MA(CR, M), M / 2.5 + 1), the average as of that many bars before, the fraction of the shift cut off (see crShift): 10, 20, 40 and 62 bars by default, shifted by 5, 9, 17 and 25.

CRSIvariable源码

const CRSI: IndicatorDefinition<{
  rsiLength: number;
  streakLength: number;
  rocLength: number;
}>

Connors RSI: the mean of Wilder's RSI of the price over 3 bars, Wilder's RSI over 2 bars of the streak of rises and falls (see StreakStep), and the percent rank of the one-bar rate of change among the previous 100 ones. The rate of change starts on the second bar, so it starts on bar rocLength + 1.

DCvariable源码

const DC: IndicatorDefinition<{ period: number }>

Donchian Channels: the highest high and lowest low of period bars, and their average.

DEFAULT_SESSIONSvariable源码

const DEFAULT_SESSIONS: readonly SessionRange[]

The trading hours of Tokyo, London and New York.

DEMAvariable源码

const DEMA: IndicatorDefinition<{ period: number }>

Double exponential moving average: 2 * EMA - EMA(EMA) of the price, each EMA seeded with the simple average of its first values, so it starts on bar 2 * (length - 1).

DMAvariable源码

const DMA: IndicatorDefinition<{ fast: number; slow: number; signal: number }>

平行线差 (difference of moving averages), as in Chinese charting software: DIF = MA(C, N1) - MA(C, N2) and its average DIFMA = MA(DIF, M).

DMIvariable源码

const DMI: IndicatorDefinition<{ adxSmoothing: number; diLength: number }>

Directional movement index: ADX, +DI and -DI.

DPOvariable源码

const DPO: IndicatorDefinition<{ period: number; centered: number }>

Detrended price oscillator: the price minus its simple average of period / 2 + 1 bars back (the shift rounded down). Centered, it is the price of that many bars back minus the average, drawn back on the bar of that price.

EFIvariable源码

const EFI: IndicatorDefinition<{ period: number }>

Elder's force index: the EMA of period bars of the change of the close times the volume, seeded with the simple average of the first period forces; the first bar has no change, so it starts on bar period.

EMAvariable源码

const EMA: IndicatorDefinition<{ periods: readonly number[] }>

Exponential moving averages, alpha = 2 / (length + 1), seeded with the simple average.

EMVvariable源码

const EMV: IndicatorDefinition<{ period: number; divisor: number }>

Ease of movement: how far the median price moves for the volume traded, divisor * Δ((H + L) / 2) * (H - L) / VOLUME, averaged over period bars; bars without volume are skipped.

ENVELOPEvariable源码

const ENVELOPE: IndicatorDefinition<{
  period: number;
  percent: number;
  exponential: number;
}>

Envelope: a simple moving average of the price (or an EMA seeded with its simple average) and the lines percent percent above and below it, the area between them shaded.

FISHERvariable源码

const FISHER: IndicatorDefinition<{ period: number }>

FRACTALSvariable源码

const FRACTALS: IndicatorDefinition<{ period: number }>

Bill Williams' fractals: a low below the period lows on either side, marked under its bar, and a high above the highs on either side, marked over it; before the fractal up to four values may equal it. A fractal is known period bars later, and drawn back on its bar.

HMAvariable源码

const HMA: IndicatorDefinition<{ periods: readonly number[] }>

HVvariable源码

const HV: IndicatorDefinition<{ period: number }>

Historical volatility: the population standard deviation of period logarithmic returns of the close, ln(C / C'), in percent, annualized by the bars' interval: times sqrt(365) on intraday and one-day bars (and bars without an interval), times sqrt(365 / 7) on bars of several days, weeks and months. The first bar has no return, so it starts on bar period.

ICHIMOKUvariable源码

const ICHIMOKU: IndicatorDefinition<{
  conversion: number;
  base: number;
  spanB: number;
  displacement: number;
}>

Ichimoku Kinko Hyo: the conversion and base lines are the middles of the high-low ranges of their periods, leading span A is their average and leading span B the middle of its own period. The spans lead by displacement - 1 bars, so the cloud between them reaches past the latest bar, and the close lags as many. The cloud takes the theme's up color where span A is higher and its down color where span B is; its upper and lower edges are hidden outputs, for alerts.

indicatorTextsvariable源码

const indicatorTexts: IndicatorTexts

The words of the library's indicators: their full names in English, Chinese, Japanese and Korean, and the labels of their outputs, parameters and options in the last three. Given to the module, the legend and valuesAt() follow the chart's locale:

indicators(allIndicators, { texts: [indicatorTexts] });

KAMAvariable源码

const KAMA: IndicatorDefinition<{ period: number; fast: number; slow: number }>

KCvariable源码

const KC: IndicatorDefinition<{
  period: number;
  multiplier: number;
  exponential: number;
  bandStyle: number;
  atrPeriod: number;
}>

Keltner Channels: an EMA of the price (or an SMA), seeded with its simple average, and bands multiplier times the average true range of atrPeriod bars above and below it, or times the true range of the bar, or times Wilder's smoothing of the bar's range over period bars.

KDJvariable源码

const KDJ: IndicatorDefinition<{ period: number; k: number; d: number }>

随机指标 as in Chinese charting software: RSV = (C - LLV(L, N)) / (HHV(H, N) - LLV(L, N)) * 100, K = SMA(RSV, M1, 1), D = SMA(K, M2, 1) and J = 3K - 2D; SMA(X, N, 1) starts from the first X, on the first bar with period bars.

KSTvariable源码

const KST: IndicatorDefinition<KstParams>

Know sure thing: simple averages of four rates of change of the price, 100 * (X - X[N]) / X[N] over 10, 15, 20 and 30 bars averaged over 10, 10, 10 and 15, weighed 1 to 4, and their simple average over 9 values as the signal line. It starts once the slowest is averaged, on bar 44 by default, the signal line 8 bars later.

KVOvariable源码

const KVO: IndicatorDefinition<{ fast: number; slow: number; signal: number }>

Klinger oscillator: the volume, positive where the typical price (H + L + C) / 3 did not fall and negative where it fell (and on the first bar, which has no change), through its EMA of fast bars minus its EMA of slow bars; the signal line is the EMA of signal values of it. Each EMA is seeded with the simple average of its first values.

LSMAvariable源码

const LSMA: IndicatorDefinition<{ period: number; offset: number }>

Least squares moving average: the linear regression of the latest period prices, read on the latest bar, or offset bars before it (after it when negative). It starts on bar period - 1.

MAvariable源码

const MA: IndicatorDefinition<{ periods: readonly number[] }>

Simple moving averages, one line for each length.

MACDvariable源码

const MACD: IndicatorDefinition<{
  fast: number;
  slow: number;
  signal: number;
  oscillatorType: number;
  signalType: number;
}>

MACD: the fast EMA of the price minus the slow one, its EMA as the signal line, and the histogram of MACD minus the signal line. Either average can be an SMA instead. Each EMA is seeded with the simple average of its first values, so MACD starts on bar slow - 1 and the signal line signal - 1 bars later.

MASSvariable源码

const MASS: IndicatorDefinition<{ period: number }>

Mass index: the EMA of 9 bars of the range H - L divided by the EMA of 9 values of that EMA, summed over period bars. Each EMA is seeded with the simple average of its first values, so the ratio starts on bar 16 and the index on bar 16 + period - 1.

MCGINLEYvariable源码

const MCGINLEY: IndicatorDefinition<{ period: number }>

McGinley Dynamic: a moving average that speeds up as the price runs away from it, MD = MD' + (X - MD') / (N * (X / MD')^4), starting from the simple average of the first N prices.

MFIvariable源码

const MFI: IndicatorDefinition<{ period: number }>

MIKEvariable源码

const MIKE: IndicatorDefinition<{ period: number }>

麦克支撑压力 (MIKE support and resistance), as in Chinese charting software: HLC = REF(MA((H + L + C) / 3, N), 1), HV = EMA(HHV(H, N), 3), LV = EMA(LLV(L, N), 3), and the resistances STOR = EMA(2 * HV - LV, 3), MIDR = EMA(HLC + HV - LV, 3), WEKR = EMA(HLC * 2 - LV, 3) and the supports WEKS = EMA(HLC * 2 - HV, 3), MIDS = EMA(HLC - HV + LV, 3), STOS = EMA(2 * LV - HV, 3). EMA(X, 3) starts from the first X: STOR and STOS on bar N - 1, the others, of the average of the bars before, on bar N.

MTMvariable源码

const MTM: IndicatorDefinition<{ period: number }>

Momentum: the price minus the price period bars back.

OBVvariable源码

const OBV: IndicatorDefinition<SmoothingParams>

On-balance volume, and a moving average of it if picked, none by default.

PIVOTHLvariable源码

const PIVOTHL: IndicatorDefinition<{
  highLeft: number;
  highRight: number;
  lowLeft: number;
  lowRight: number;
}>

Pivot points high low: a high above the highRight highs after it and at least as high as the highLeft highs before it, marked over its bar with its price, and a low below the lowRight lows after it and at least as low as the lowLeft before it, marked under its bar. A pivot is known right bars later, and drawn back on its bar.

PIVOTSvariable源码

const PIVOTS: IndicatorDefinition<{ kind: number; period: number }>

Pivot points of the previous period of the chart's calendar (day, week, month, quarter, one or several years), drawn as a level over the current one: Traditional, Fibonacci, Woodie, Classic, DM or Camarilla. Auto follows the chart's interval: days on bars of 15 minutes or less and on bars without an interval, weeks on other intraday bars, months on daily bars and years on weekly and monthly ones.

PPOvariable源码

const PPO: IndicatorDefinition<{ short: number; long: number; exponential: number }>

Percentage price oscillator: the short simple average of the price minus the long one, in percent of the long one, from bar long - 1. Exponential, each average is an EMA seeded with the simple average of its first values, so it starts on the same bar.

PREVHLCvariable源码

const PREVHLC: IndicatorDefinition<{ period: number }>

The high, low and close of the previous period of the chart's calendar (the previous trading day, week, month, quarter or year), drawn as levels over the current one.

PSYvariable源码

const PSY: IndicatorDefinition<{ period: number; signal: number }>

心理线 (psychological line): PSY = COUNT(C > C', N) / N * 100 and PSYMA = MA(PSY, M).

PVTvariable源码

const PVT: IndicatorDefinition<Record<string, never>>

Price volume trend: the running total of (C - C') / C' * V, the volume times the relative change of the close, from 0 on the first bar, which has no change.

RIBBONvariable源码

const RIBBON: IndicatorDefinition<RibbonParams>

Moving average ribbon: four moving averages of the price, SMAs of 20, 50, 100 and 200 by default, each of the type picked: simple, exponential, Wilder's (RMA), linearly weighted or volume-weighted, as the averages of the library compute them.

ROCvariable源码

const ROC: IndicatorDefinition<{ period: number }>

Rate of change: 100 * (X - X[N]) / X[N] of the price over period bars.

RSIvariable源码

const RSI: IndicatorDefinition<{ period: number } & SmoothingParams>

Relative strength index: Wilder's RSI of period changes of the price, and a moving average of it, an SMA of 14 values by default, with Bollinger Bands around it if picked.

RVGIvariable源码

const RVGI: IndicatorDefinition<{ period: number }>

Relative vigor index: the body C - O and the range H - L of each bar, each a symmetric weighted average of four bars (weights 1, 2, 2, 1), summed over 10 bars; RVGI is the sum of the bodies over that of the ranges, from bar period + 2, and the signal line its symmetric weighted average, 3 bars later. Undefined over bars without range.

RVOLvariable源码

const RVOL: IndicatorDefinition<{ anchor: number; period: number; mode: number }>

Relative volume at time: the volume of the period of the chart's calendar (trading day by default) up to the bar, against its average over the period periods before up to the same time after their start; in regular mode the bar's own volume against that of the bars at that time. In each past period the bar that started at that time after the period's start counts, else the latest one before it; a period without a bar by then is left out of the average. The first period starts with the first bar. With an anchor no longer than the bars, each bar is a period of its own: its volume against the average of the period bars before. The current and the past volume are shown too.

SARvariable源码

const SAR: IndicatorDefinition<{ start: number; increment: number; maximum: number }>

Parabolic SAR, a dot under the bars in an uptrend and over them in a downtrend.

SESSIONSvariable源码

const SESSIONS: IndicatorDefinition<Record<string, never>>

The sessions of Tokyo, London and New York, as DEFAULT_SESSIONS holds them.

SMIvariable源码

const SMI: IndicatorDefinition<{ kLength: number; dLength: number; emaLength: number }>

Stochastic momentum index: the close's distance from the middle of the highest high and the lowest low of 10 bars, and the width of that range, each smoothed twice by an EMA of 3 values; 200 * distance / width, and its EMA of 3 values. Each EMA is seeded with the simple average of its first values, so SMI starts on bar kLength + 2 * (dLength - 1) - 1 and its EMA `emaLength

  • 1` bars later; undefined while the smoothed width is 0.

SMMAvariable源码

const SMMA: IndicatorDefinition<{ periods: readonly number[] }>

Smoothed (Wilder) moving averages, y = (y' * (length - 1) + x) / length, seeded with the simple average of the first length values.

STDvariable源码

const STD: IndicatorDefinition<{ period: number }>

Population standard deviation of the source price.

STOCHvariable源码

const STOCH: IndicatorDefinition<{ period: number; smoothK: number; smoothD: number }>

Stochastic, 14, 1, 3 by default: the close within the range of period bars, in percent (undefined over a flat range, which the averages skip), averaged over smoothK bars into %K and over smoothD into %D. KDJ is the variant of Chinese charting software.

STOCHRSIvariable源码

const STOCHRSI: IndicatorDefinition<{
  smoothK: number;
  smoothD: number;
  rsiPeriod: number;
  period: number;
}>

Stochastic RSI: Wilder's RSI of rsiPeriod changes, its stochastic over period values, averaged over smoothK into K and over smoothD into D.

SUPERTRENDvariable源码

const SUPERTREND: IndicatorDefinition<{ period: number; multiplier: number }>

SuperTrend: a line under the bars in the theme's up color while the trend is up, over them in the down color while it is down, with a gap where it turns, each shaded to the middle of the bodies of the bars.

TEMAvariable源码

const TEMA: IndicatorDefinition<{ period: number }>

Triple exponential moving average: 3 * (EMA - EMA(EMA)) + EMA(EMA(EMA)) of the price, each EMA seeded with the simple average of its first values, so it starts on bar 3 * (length - 1).

TRIXvariable源码

const TRIX: IndicatorDefinition<{ period: number }>

Triple exponential average: 10000 * Δ EMA(EMA(EMA(ln(price), N), N), N), each EMA seeded with the simple average of its first values.

TSIvariable源码

const TSI: IndicatorDefinition<{ long: number; short: number; signal: number }>

True strength index: the change of the price smoothed by an EMA of 25 values and that by an EMA of 13, over its size smoothed alike, in percent, and its EMA of 13 values as the signal line. Each EMA is seeded with the simple average of its first values, and the changes start on the second bar, so it starts on bar long + short - 1, the signal line signal - 1 bars later.

UOvariable源码

const UO: IndicatorDefinition<{ fast: number; middle: number; slow: number }>

Ultimate oscillator: the buying pressure C - MIN(L, C') over the true range MAX(H, C') - MIN(L, C'), each summed over 7, 14 and 28 bars, weighed 4, 2 and 1, in percent. The first bar has no previous close, so it starts on bar slow; undefined over bars without range.

VOvariable源码

const VO: IndicatorDefinition<{ short: number; long: number }>

Volume oscillator: 100 * (EMA(V, short) - EMA(V, long)) / EMA(V, long), each EMA seeded with the simple average of its first values; undefined while the long EMA is 0.

VOLvariable源码

const VOL: IndicatorDefinition<{ periods: readonly number[] }>

Volume columns colored by the bar direction, with simple moving averages of the volume.

VORTEXvariable源码

const VORTEX: IndicatorDefinition<{ period: number }>

Vortex indicator: VI+ = SUM(|H - L'|, N) / SUM(TR, N) and VI- = SUM(|L - H'|, N) / SUM(TR, N) against the previous bar's low L' and high H', the true range of the first bar being its high minus its low. Both start on bar N, the first with N previous bars; undefined over a window without range.

VRvariable源码

const VR: IndicatorDefinition<{ period: number; signal: number }>

成交量变异率 (volume ratio), as in Chinese charting software: VR = (2 * TH + TQ) / (2 * TL + TQ) * 100 of the volume of the up (TH), down (TL) and unchanged (TQ) closes of period bars, and its average MAVR = MA(VR, M).

VSTOPvariable源码

const VSTOP: IndicatorDefinition<{ period: number; multiplier: number }>

Volatility stop: a dot under the bars in the theme's up color while the trend is up, over them in its down color while it is down. The stop trails the price's extreme since the trend turned by multiplier ATRs of period bars (Wilder's, seeded with the mean of the first true ranges), only tightening; the true range, unmultiplied, stands in while the ATR warms up. The first bar's stop is its price, in an uptrend; a price through the stop turns the trend.

VWAPvariable源码

const VWAP: IndicatorDefinition<VwapParams>

VWAP restarting every trading day of the chart's calendar (or week, month, quarter, year), of hlc3 by default, with up to three bands of standard deviations or percents; the first, of one deviation, on by default.

VWMAvariable源码

const VWMA: IndicatorDefinition<{ periods: readonly number[] }>

Volume-weighted moving averages, SUM(price * volume, N) / SUM(volume, N).

WMAvariable源码

const WMA: IndicatorDefinition<{ periods: readonly number[] }>

Linearly weighted moving averages, the newest value weighing length and the oldest 1.

WRvariable源码

const WR: IndicatorDefinition<{ periods: readonly number[] }>

Williams %R: the price below the highest high of period bars, in percent of their range, from -100 at the lowest low to 0 at the highest high; undefined over a flat range.

WVADvariable源码

const WVAD: IndicatorDefinition<{ period: number; signal: number }>

威廉变异离散量 (Williams' variable accumulation distribution), as in Chinese charting software: WVAD = SUM((C - O) / (H - L) * VOL, N) / 10000 over period bars, a bar without range adding 0, and its average MAWVAD = MA(WVAD, M).

ZIGZAGvariable源码

const ZIGZAG: IndicatorDefinition<ZigzagParams>

Zig zag: a line through the swings of the price. A swing is a high higher than the depth / 2 highs before it (at least two, rounded down) and at least as high as as many after it, or such a low, so it is known that many bars later. A swing on the side of the last pivot replaces it when beyond it, and one of the other side is the next pivot when it is deviation percent or more from the last; on one bar the high comes first. The line goes on from the last pivot to the latest bar's low after a high or its high after a low. Each pivot can be labeled with its price, its change from the pivot before, as a price or in percent, and the volume since it.

Its outputs are what each bar knew: high and low give the swings the bar took as pivots, drawn back on their bars, and zigZag the low or high the line would go on to on it. Of consecutive high values (or low values), only the last is still a pivot.

↑↓ 选择 · Enter 打开 · Esc 关闭