Class containing various helper methods for data handling and color conversions.

Hierarchy

  • HelperRoutines

Constructors

Methods

  • Calculates Heikin Ashi values based on the given dataset.

    Parameters

    • data: XOHLC[]

      Dataset to calculate from.

    Returns XOHLC[]

    An array of Heikin Ashi values.

  • Converts color to HEX format string (e.g #FFFFFF)

    Parameters

    • color: Color

      Color to convert to a string.

    • excludeAlpha: boolean = false

      Set true to exclude Alpha channel from the conversion.

    Returns string

    HEX format string.

  • Converts HEX format string to Color object.

    Parameters

    • colorString: string

      String to convert to Color, should be in HEX format e.g. #FFFFFF.

    Returns Color

    Converted Color, or null if conversion wasn't possible.

  • Extracts all Close values from the current dataset.

    Parameters

    • data: XOHLC[]

      Data values to extract from.

    Returns number[]

    Array of Close values, or empty array if unable to extract.

  • Extracts all High values from the current dataset.

    Parameters

    • data: XOHLC[]

      Data values to extract from.

    Returns number[]

    Array of High values, or empty array if unable to extract.

  • Extracts all Low values from the current dataset.

    Parameters

    • data: XOHLC[]

      Data values to extract from.

    Returns number[]

    Array of Low values, or empty array if unable to extract.

  • Extracts all Open values from the current dataset.

    Parameters

    • data: XOHLC[]

      Data values to extract from.

    Returns number[]

    Array of Open values, or empty array if unable to extract.

  • Extracts all position values (X-values) from the current dataset.

    Parameters

    • data: XOHLC[]

      Data values to extract from.

    Returns number[]

    Array of positions values, or empty array if unable to extract.

  • Converts a csv-string to separate data arrays.

    Parameters

    • csvString: string

      csv-string to convert.

    • startDate: Date = ...

      Optional date value to parse the data. Rows before this will be excluded from the return array.

    • endDate: Date = ...

      Optional date value to parse the data. Rows after this will be excluded from the return array.

    • delimiter: string = ","

      Character used to separate entries, comma by default.

    Returns any[][]

    An array containing the following arrays:

    -Array of date strings

    -Array of Open values

    -Array of High values

    -Array of Low values

    -Array of Close values

    -Array of Volumes, empty if Volumes were not provided in the csv-file.

    -Array of Open Interests, empty if Open Interests were not provided in the csv-file.

  • Sorts the given dataset according to DateTime values, returning a new array with oldest points first and newest last.

    Parameters

    Returns DataPoint[]

    • A new array of sorted data points.