Chartbreaker
    Preparing search index...

    A TimeSeries object represents a set of data values such as OHLC-quotes with volume information or some other arbitrary data.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Phantom data for type inference

    optionGroups?: ObjectOptionGroup[]
    options: { [key: string]: any }
    options: {
        bufferHandle: { type: string; _get(this: TimeSeries): number };
        customName: {
            type: string;
            value: string;
            _set(this: TimeSeries, v: string): void;
        };
        displacement: {
            flags: ObjectEOptionFlags;
            hint: string;
            name: string;
            type: string;
            _get(this: TimeSeries): string;
            _set(this: TimeSeries, v: string): void;
        };
        errorMessage: { flags: number; type: string; value: null };
        identifier: { type: string; _get(this: TimeSeries): string };
        isMainTimeSeries: { type: string; _get(this: TimeSeries): boolean };
        legend: { type: string; _get(this: TimeSeries): string };
        legendFormat: {
            type: string;
            _get(this: TimeSeries): string;
            _set(this: TimeSeries, v: string): void;
        };
        plotType: {
            flags: ObjectEOptionFlags;
            name: string;
            type: | {
                candle: "Candles";
                heikinashi: "HeikinAshi";
                kagi: "Kagi";
                line: "Line";
                linebreak: "Line Break";
                mcandle: "M-Candle";
                mountain: "Mountain";
                ohlc: "OHLC";
                pf: "Point and Figure";
                rangebar: "Range Bars";
                renko: "Renko";
                thresholdLine: "Threshold Line";
            }
            | {
                candle: "Candles";
                heikinashi?: undefined;
                kagi?: undefined;
                line: "Line";
                linebreak?: undefined;
                mcandle: "M-Candle";
                mountain: "Mountain";
                ohlc: "OHLC";
                pf?: undefined;
                rangebar?: undefined;
                renko?: undefined;
                thresholdLine: "Threshold Line";
            }
            | {
                candle?: undefined;
                heikinashi: "HeikinAshi";
                kagi: "Kagi";
                line?: undefined;
                linebreak: "Line Break";
                mcandle?: undefined;
                mountain?: undefined;
                ohlc?: undefined;
                pf: "Point and Figure";
                rangebar: "Range Bars";
                renko: "Renko";
                thresholdLine?: undefined;
            }
            | {
                candle?: undefined;
                heikinashi?: undefined;
                kagi?: undefined;
                line?: undefined;
                linebreak?: undefined;
                mcandle?: undefined;
                mountain?: undefined;
                ohlc?: undefined;
                pf?: undefined;
                rangebar?: undefined;
                renko?: undefined;
                thresholdLine?: undefined;
            };
            _get(this: TimeSeries): string;
            _set(this: TimeSeries, v: string): void;
        };
        precision: {
            type: string;
            _get(this: TimeSeries, v: string): number;
            _set(this: TimeSeries, v: number): void;
        };
        referenceTimestamp: { type: string; value: number };
        referenceValue: { type: string; value: number };
        relative: {
            flags: ObjectEOptionFlags;
            name: string;
            type: string;
            _get(this: TimeSeries): boolean;
            _set(this: TimeSeries, v: boolean): void;
        };
        transformation: { type: string; value: string };
        transformationDetails: { type: string; value: string };
        type: { type: string; _get(this: TimeSeries): string };
        value: { type: string; _get(this: TimeSeries, v: string): number };
    }

    Type Declaration

    • bufferHandle: { type: string; _get(this: TimeSeries): number }

      the first buffer handle of the underlying data

      bufferHandle

    • customName: { type: string; value: string; _set(this: TimeSeries, v: string): void }

      an optional manually assigned custom name to overwrite the automatically assigned name provided by the loader

      customName

    • displacement: {
          flags: ObjectEOptionFlags;
          hint: string;
          name: string;
          type: string;
          _get(this: TimeSeries): string;
          _set(this: TimeSeries, v: string): void;
      }
    • errorMessage: { flags: number; type: string; value: null }

      error message to be shown to the user

      errorMessage

    • identifier: { type: string; _get(this: TimeSeries): string }

      the full identifier of the timeseries

      identifier

    • isMainTimeSeries: { type: string; _get(this: TimeSeries): boolean }

      check if this timeseries is the main time series in its context

      to promote a timeseries, use Controller.selectMainTimeSeries

      isMainTimeSeries

    • legend: { type: string; _get(this: TimeSeries): string }

      the name of this timeseries legend entry

      legend

    • legendFormat: {
          type: string;
          _get(this: TimeSeries): string;
          _set(this: TimeSeries, v: string): void;
      }

      the format of the display name to be shown in the legend supports variables like {name} multiple variables can be joined with {SEPARATOR|VARIABLE|VARIABLE|...}

      also supports conditionals that are only displayed when at least one enclosed variable has a value: "[Currency: {currency}]"

      available variables depend on used data loader that has to provide them in the properties object as part of the metadata

      Example: "{name}[ ({, |currency|qs})]" => "DAX (XXP, Last)" or "Foo (Bid)" or "Foo ($)" or "Foo"

      legendFormat

    • plotType: {
          flags: ObjectEOptionFlags;
          name: string;
          type:
              | {
                  candle: "Candles";
                  heikinashi: "HeikinAshi";
                  kagi: "Kagi";
                  line: "Line";
                  linebreak: "Line Break";
                  mcandle: "M-Candle";
                  mountain: "Mountain";
                  ohlc: "OHLC";
                  pf: "Point and Figure";
                  rangebar: "Range Bars";
                  renko: "Renko";
                  thresholdLine: "Threshold Line";
              }
              | {
                  candle: "Candles";
                  heikinashi?: undefined;
                  kagi?: undefined;
                  line: "Line";
                  linebreak?: undefined;
                  mcandle: "M-Candle";
                  mountain: "Mountain";
                  ohlc: "OHLC";
                  pf?: undefined;
                  rangebar?: undefined;
                  renko?: undefined;
                  thresholdLine: "Threshold Line";
              }
              | {
                  candle?: undefined;
                  heikinashi: "HeikinAshi";
                  kagi: "Kagi";
                  line?: undefined;
                  linebreak: "Line Break";
                  mcandle?: undefined;
                  mountain?: undefined;
                  ohlc?: undefined;
                  pf: "Point and Figure";
                  rangebar: "Range Bars";
                  renko: "Renko";
                  thresholdLine?: undefined;
              }
              | {
                  candle?: undefined;
                  heikinashi?: undefined;
                  kagi?: undefined;
                  line?: undefined;
                  linebreak?: undefined;
                  mcandle?: undefined;
                  mountain?: undefined;
                  ohlc?: undefined;
                  pf?: undefined;
                  rangebar?: undefined;
                  renko?: undefined;
                  thresholdLine?: undefined;
              };
          _get(this: TimeSeries): string;
          _set(this: TimeSeries, v: string): void;
      }

      the timeseries' layer type. Valid values:

      • ** line **
      • ** candle **
      • ** mcandle **
      • ** mountain **
      • ** ohlc **
      • ** pf **
      • ** renko **
      • ** kagi **
      • ** heikinashi **

      [plotType=line]

    • precision: {
          type: string;
          _get(this: TimeSeries, v: string): number;
          _set(this: TimeSeries, v: number): void;
      }

      maximum decimal precision of the provided values

      precision

    • referenceTimestamp: { type: string; value: number }

      the entries reference timestamp for relative benchmark charts this value is always zero in absolute charts

      referenceTimestamp

    • referenceValue: { type: string; value: number }

      the entries reference value for relative benchmark charts this value is always zero in absolute charts

      referenceValue

    • relative: {
          flags: ObjectEOptionFlags;
          name: string;
          type: string;
          _get(this: TimeSeries): boolean;
          _set(this: TimeSeries, v: boolean): void;
      }

      transforms timeseries data to relative performance

      relative

    • transformation: { type: string; value: string }

      the type of transformation applied to the entries raw values possible values include but are not limited to: candle, pf, kagi, renko, ha

      transformation

    • transformationDetails: { type: string; value: string }

      additional information about transformation parameters applied to the entries raw values this could e.g. include box size and reversal for point and figure charts

      transformationDetails

    • type: { type: string; _get(this: TimeSeries): string }

      the data source type of this timeseries

      type

    • value: { type: string; _get(this: TimeSeries, v: string): number }

      the timeseries' most recent primary value

      value

    Methods

    • Type Parameters

      • Type extends
            | "attrChanged"
            | "optionChanged"
            | "stateChanged"
            | "optionsModified"
            | "displacement"
            | "propertiesUpdated"
      • Callback extends
            | (
                (
                    optionName: string,
                    attributeName: string,
                    oldValue: any,
                    newValue: any,
                ) => void
            )
            | ((optionName: string, oldValue?: any, newValue?: any) => void)
            | ((state: ObjectState, flags: ObjectStateEFlags) => void)
            | (() => void)
            | (() => void)
            | () => void & () => void

      Parameters

      Returns this

      adds a listener to the end of the listeners array for the specified event.

    • returns or sets the attribute of an option this function should be used with care - modifications of internal properties might break stuff!

      Parameters

      Returns any

    • must be called after willUpdateOptions once all actions that might potentially changed values of any options are done

      IMPORTANT: methods must be called in balance; e.g. for each call to willUpdateOptions, you must call didUpdateOptions exactly once.

      Parameters

      Returns void

    • Type Parameters

      • Type extends
            | "attrChanged"
            | "optionChanged"
            | "stateChanged"
            | "optionsModified"
            | "displacement"
            | "propertiesUpdated"
      • Callback extends
            | (
                (
                    optionName: string,
                    attributeName: string,
                    oldValue: any,
                    newValue: any,
                ) => void
            )
            | ((optionName: string, oldValue?: any, newValue?: any) => void)
            | ((state: ObjectState, flags: ObjectStateEFlags) => void)
            | (() => void)
            | (() => void)
            | () => void & () => void

      Parameters

      Returns boolean

      execute each of the listeners in order with the supplied parameters.

    • returns a flat representation of all available config options in the form of a key-value-object optionally only values that are not read-only can be returned

      IMPORTANT: this method will always convert I18NStrings to strings, so for displaying strings in a UI use individual calls to Object:get instead

      Parameters

      • OptionalreadWriteOnly: boolean

        default: true

      • OptionalmodifiedOnly: boolean

        default: true

      • OptionalnonEphemeralOnly: boolean

        default: true

      Returns { [key: string]: any }

    • returns the value of the requested option, or a list of all available config options if no parameter is specified.

      Parameters

      • Optionals: string
      • Optionalflags: number

      Returns any

    • returns the specified buffer valid values are: close,open,high,low,volume

      Parameters

      • type: "open" | "high" | "low" | "close" | "volume"

      Returns null | Buffer

    • returns a key-value object containing arbitrary properties provided by the underlying data source

      Returns null | { [key: string]: any }

    • returns a specific property provided by the underlying data source

      Parameters

      • name: string

      Returns any

    • Automatically toggles the EXPOSED flag on dependent options when a 'parent' option changes value.

      For each entry in optionDependencies, whenever the parent option emits an optionChanged event, its dependents (listed in dependentNames) will be exposed (flag added) if the new value === exposeWhen, or hidden (flag removed) otherwise.

      Parameters

      • optionDependencies: OptionExposureRelations

        Map where:

        • key = name of the 'parent' option to watch
        • value = an object with:
          • exposeWhen: the boolean that triggers exposing the dependents or a function with the newValue for custom validation
          • dependentNames: array of dependent option names whose EXPOSED flag will be toggled

      Returns void

      class Test extends ChartbreakerObject {
      constructor() {
      super();
      this.registerOptionDependencyVisibility(new Map([
      ['showLine', { exposeWhen: true, dependentNames: ['lineColor', 'lineStyle'] }],
      ['advancedMode', { exposeWhen: false, dependentNames: ['simpleModeOnlyOption'] }],
      ['description'], { exposeWhen: (text) => !!text.length, ['fontSize', 'fontColor']}
      ]));
      }
      }
    • Type Parameters

      • Type extends
            | "attrChanged"
            | "optionChanged"
            | "stateChanged"
            | "optionsModified"
            | "displacement"
            | "propertiesUpdated"
      • Callback extends
            | (
                (
                    optionName: string,
                    attributeName: string,
                    oldValue: any,
                    newValue: any,
                ) => void
            )
            | ((optionName: string, oldValue?: any, newValue?: any) => void)
            | ((state: ObjectState, flags: ObjectStateEFlags) => void)
            | (() => void)
            | (() => void)
            | () => void & () => void

      Parameters

      Returns Callback[]

      returns an array of listeners for the specified event.

    • Type Parameters

      • Type extends
            | "attrChanged"
            | "optionChanged"
            | "stateChanged"
            | "optionsModified"
            | "displacement"
            | "propertiesUpdated"
      • Callback extends
            | (
                (
                    optionName: string,
                    attributeName: string,
                    oldValue: any,
                    newValue: any,
                ) => void
            )
            | ((optionName: string, oldValue?: any, newValue?: any) => void)
            | ((state: ObjectState, flags: ObjectStateEFlags) => void)
            | (() => void)
            | (() => void)
            | () => void & () => void

      Parameters

      Returns this

      alias for addListener

    • Type Parameters

      • Type extends
            | "attrChanged"
            | "optionChanged"
            | "stateChanged"
            | "optionsModified"
            | "displacement"
            | "propertiesUpdated"
      • Callback extends
            | (
                (
                    optionName: string,
                    attributeName: string,
                    oldValue: any,
                    newValue: any,
                ) => void
            )
            | ((optionName: string, oldValue?: any, newValue?: any) => void)
            | ((state: ObjectState, flags: ObjectStateEFlags) => void)
            | (() => void)
            | (() => void)
            | () => void & () => void

      Parameters

      Returns this

      adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.

    • called when an object will be permanently discarded no other methods will be called on it ever again after this point

      IMPORTANT: this method should ONLY be called directly on the Controller all other objects will be destroyed automatically by the implementation

      Returns void

    • life cycle method; called when the object should recover from an error and resume normal operation

      this will only be called if the object encountered a RecoverableChartbreakerError, and is always triggered by a manual user interaction

      always called between start and stop

      Returns void

    • life cycle method; called when the object should start normal operation at this point is is already completely initialized

      Parameters

      Returns void

    • life cycle method; called when the object should stop normal operation if objects have any pending subscriptions/requests, they should all be stopped here

      the object is also responsible for clearing the loading flag from it's state if it is currently active failing to do so will trigger a fatal error

      object might be started again afterwards (start) or destroyed (destroy) this is not known yet at this point

      called after start or restart

      Returns void

    • can be called to tell the object that it should recover from an error and resume will have no effect if no retryable error is currently associated with the object

      Returns boolean

    • Type Parameters

      • Type extends
            | "attrChanged"
            | "optionChanged"
            | "stateChanged"
            | "optionsModified"
            | "displacement"
            | "propertiesUpdated"

      Parameters

      Returns this

      removes all listeners, or those of the specified event.

    • Type Parameters

      • Type extends
            | "attrChanged"
            | "optionChanged"
            | "stateChanged"
            | "optionsModified"
            | "displacement"
            | "propertiesUpdated"
      • Callback extends
            | (
                (
                    optionName: string,
                    attributeName: string,
                    oldValue: any,
                    newValue: any,
                ) => void
            )
            | ((optionName: string, oldValue?: any, newValue?: any) => void)
            | ((state: ObjectState, flags: ObjectStateEFlags) => void)
            | (() => void)
            | (() => void)
            | () => void & () => void

      Parameters

      Returns this

      remove a listener from the listener array for the specified event.

    • will set validate and then set the specified option(s) to the provided value(s) after validation

      NOTE: if multiple options are used, will return false if at least one value is not valid values are applied individually however, so one option might be set even if the value for another is invalid

      Parameters

      Returns boolean

    • Parameters

      • maxListeners: number

      Returns this

      by default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that limit to be increased. Set to zero for unlimited.

    • Sets the objName and objType of the Object reverts to the default ones if no arguments are given

      Parameters

      • OptionalobjType: string
      • OptionalobjName: string

      Returns void

    • will set validate value(s) for the specified option(s)

      NOTE: if multiple options are used, will return false if at least one value is not valid

      Parameters

      Returns boolean

    • when using custom getters/setters (via _get/_set) in options, the values of options can change without .set being called - or there might not even be a setter for readonly options; for example, if the getter simply returns the value of a member variable this variable could be modified directly. In this case, events such as optionChanged would not be fired, and listeners would not be informed about the change.

      To account for such cases, the methods willUpdateOptions and didUpdateOptions should be called directly BEFORE and AFTER actions that might potentially change values of options. the correct events will then automatically be triggered when calling didUpdateOptions.

      if the options that could change are known, they can be supplied via the optional parameter. This provides a small performance gain in most situations.

      IMPORTANT: methods must be called in balance; e.g. for each call to willUpdateOptions, you must call didUpdateOptions exactly once.

      Parameters

      • Optionaloptions: string | string[]

      Returns void

    • Parameters

      • timeBased: boolean
      • valueBased: boolean

      Returns
          | {
              candle: "Candles";
              heikinashi: "HeikinAshi";
              kagi: "Kagi";
              line: "Line";
              linebreak: "Line Break";
              mcandle: "M-Candle";
              mountain: "Mountain";
              ohlc: "OHLC";
              pf: "Point and Figure";
              rangebar: "Range Bars";
              renko: "Renko";
              thresholdLine: "Threshold Line";
          }
          | {
              candle: "Candles";
              heikinashi?: undefined;
              kagi?: undefined;
              line: "Line";
              linebreak?: undefined;
              mcandle: "M-Candle";
              mountain: "Mountain";
              ohlc: "OHLC";
              pf?: undefined;
              rangebar?: undefined;
              renko?: undefined;
              thresholdLine: "Threshold Line";
          }
          | {
              candle?: undefined;
              heikinashi: "HeikinAshi";
              kagi: "Kagi";
              line?: undefined;
              linebreak: "Line Break";
              mcandle?: undefined;
              mountain?: undefined;
              ohlc?: undefined;
              pf: "Point and Figure";
              rangebar: "Range Bars";
              renko: "Renko";
              thresholdLine?: undefined;
          }
          | {
              candle?: undefined;
              heikinashi?: undefined;
              kagi?: undefined;
              line?: undefined;
              linebreak?: undefined;
              mcandle?: undefined;
              mountain?: undefined;
              ohlc?: undefined;
              pf?: undefined;
              rangebar?: undefined;
              renko?: undefined;
              thresholdLine?: undefined;
          }