Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Calculator

Indicator's algorithm should implement this interface. The app assigns the properties upon initialization of the calculator instance.

Hierarchy

  • Calculator

Properties

chartDescription: object

Chart's element description

Type declaration

  • Readonly elementSize: number

    The size of elements

  • Readonly elementSizeUnit: "UnderlyingUnits" | "Volume" | "Range" | "Renko" | "MomentumRange" | "PointAndFigure"

    Specifies the way chart elements built

  • Readonly underlyingType: "MinuteBar" | "Tick" | "DailyBar"

    Type of basis elements that are used to build the chart

  • Readonly withHistogram: boolean

    Whether the chart elements include volume profiles

contractInfo: object

Contract assigned to the indicator

Type declaration

  • Readonly contract: string

    Symbol like ESH1

  • Readonly product: string

    Name of product like ES

  • Readonly tickSize: number

    Product's tick size (or minimal price movement)

dlls: object

An object that points to materialized DLLs that were specified in Indicator.dlls. Each field is an interface object to corresponding DLL. See example of usage

Type declaration

  • [dllName: string]: object
    • [functionName: string]: function
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

props: object

An object with user-specified parameters. The indicator specifies a set of parameters in Indicator.params. When a user adds the indicator's instance to a chart, the app shows an editor that let fill out actual values.

Type declaration

  • [parameterName: string]: number | boolean

Methods

  • filter(entity: object): boolean
  • The app calls the method with the value returned by map to check if the indicator's algorithm considers to filter out some result values. The method should return true if the value should stay. The implementation is optional.

    Parameters

    • entity: object
      • [fieldName: string]: any

    Returns boolean

  • init(): void
  • The application calls the method before running an iteration through input series items. The implementation is optional. Can be used to reset an internal calculation state.

    class ema {
    init() {
    this.previousMA = undefined;
    this.initialSum = 0;
    }
    ...
    }
    

    Returns void

  • Implements the algorithm that maps a flow of values from input series to a new series.

    ...
    map(d) {
    return d.value() - this.props.offset;
    }
    ...
    

    Parameters

    Returns number | object & object

    The application expects the values in the output series at least match Indicator.plots definition. number returned value is identical to { value: number } for a basic single line plot. undefined returned value transaltes to an empty value in the output Additionally, if the function returns the result as an object, it is possible to specify styling for this particular output item and/or for the corresponding candlestick. See details in Signaling Average True Range tutorial. The function can return as well a graphics as a part of the result object. The GraphicsResponse is a declarative way to create custom plotting.

Generated using TypeDoc