Interface DataContext


public interface DataContext
This context provides an access point to services relating to data.
  • Method Summary

    Modifier and Type
    Method
    Description
    addNote(float price, String note, TextStyle style)
    Adds a note to the DOM (Depth of Market) panel and returns a unique identifier that can be used to update or remove the note.
    default Object
    addNote(float price, String note, Color bg)
    Adds a note to the DOM (Depth of Market) panel using the default font and text color.
    void
    Removes all custom bar widths for this study
    void
    clearSignal(int index, Object signalKey)
    Clears the signal flag for the given index.
    double
    getBarWidthAt(int index)
    Gets the custom bar width for the given bar index.
    Gets the current bar size for the underlying chart.
    long
    Gets the current time.
    Gets the primary data series.
    Gets additional data series objects of a different bar size.
    Defaults defined by the system.
    Gets the instrument associated with this context.
    Gets the instruments associated with this context.
    Gets the time zone for the underlying chart.
    Gets the trade instrument associated with this context.
    boolean
    Checks to see if the system is currently loading historical data.
    boolean
    Checks if the current context is in replay mode
    boolean
    Returns true if the historical data is regular trading hours (vs extended hours).
    boolean
    Checks to see if the signal with the given key is enabled.
    void
    Removes all notes from the DOM (Depth Of Market) panel that were created by the study.
    boolean
    Removes the note from the DOM (Depth Of Market) panel with the given unique id.
    void
    setBarWidthAt(int index, double barWidth)
    Sets a custom bar width for the given bar index.
    void
    signal(int index, Object signalKey, String message, Object value)
    Triggers a signal with the given key, message and value.
    boolean
    updateNote(Object id, float price, String note, TextStyle style)
    Updates the note in the DOM (Depth of Market) panel associated with unique identifier.
  • Method Details

    • getDataSeries

      DataSeries getDataSeries()
      Gets the primary data series.
      Returns:
      primary data series for this study.
    • getChartBarSize

      BarSize getChartBarSize()
      Gets the current bar size for the underlying chart.
      Returns:
      the current bar size for the underlying chart
    • getDataSeries

      DataSeries getDataSeries(BarSize barSize)
      Gets additional data series objects of a different bar size.
      Parameters:
      barSize - barSize for the data series
      Returns:
      data series of the given bar size.
    • getInstrument

      Instrument getInstrument()
      Gets the instrument associated with this context.
      Returns:
      instrument associated with this context.
    • getTradeInstrument

      Instrument getTradeInstrument()
      Gets the trade instrument associated with this context. This may be different than the primary instrument if cross trade is enabled.
      Returns:
      trade instrument associated with this context.
    • getInstruments

      List<Instrument> getInstruments()
      Gets the instruments associated with this context.
      Returns:
      instruments associated with this context.
    • signal

      void signal(int index, Object signalKey, String message, Object value)
      Triggers a signal with the given key, message and value. Note: An actual signal is only triggered if signals have been configured.
      Parameters:
      index - index of the bar that triggered this signal. Note: signals are only fired for the current bar when it is completed
      signalKey - event name of the alert (displayed to user)
      message - describes the signal (dislayed to the user, if an alert)
      value - value that triggered the alert (displayed to user)
    • clearSignal

      void clearSignal(int index, Object signalKey)
      Clears the signal flag for the given index. This may be used to trigger multiple signals on a bar.
      Parameters:
      index -
      signalKey -
    • isSignalEnabled

      boolean isSignalEnabled(Object signalKey)
      Checks to see if the signal with the given key is enabled.
      Parameters:
      signalKey - unique key that identifies the signal.
      Returns:
      true if the signal is enabled
    • isRTH

      boolean isRTH()
      Returns true if the historical data is regular trading hours (vs extended hours).
      Returns:
      true if this is regular trading hours (rth).
    • getCurrentTime

      long getCurrentTime()
      Gets the current time. This is the time synchronized with the Broker/Data Service (if supported by the underlying service).
      Returns:
      current time (synchronized with the broker/data service)
    • getTimeZone

      TimeZone getTimeZone()
      Gets the time zone for the underlying chart.
      Returns:
      time zone set for the underlying chart
    • getDefaults

      Defaults getDefaults()
      Defaults defined by the system.
      Returns:
      system defaults
    • isLoadingData

      boolean isLoadingData()
      Checks to see if the system is currently loading historical data.
      Returns:
      true if the system is currently loading data.
    • isReplayMode

      boolean isReplayMode()
      Checks if the current context is in replay mode
      Returns:
      true if Replay Mode is enabled
    • addNote

      Object addNote(float price, String note, TextStyle style)
      Adds a note to the DOM (Depth of Market) panel and returns a unique identifier that can be used to update or remove the note.
      Parameters:
      price - price for the note
      note - display text for the note
      style - text style including font background and text color
      Returns:
      unique identifier for the note
    • addNote

      default Object addNote(float price, String note, Color bg)
      Adds a note to the DOM (Depth of Market) panel using the default font and text color. Returns a unique identifier that can be used to update or remove the note.
      Parameters:
      price - price for the note
      note - display text for the note
      bg - background (cell) color for the note
      Returns:
      unique identifier for the note
    • updateNote

      boolean updateNote(Object id, float price, String note, TextStyle style)
      Updates the note in the DOM (Depth of Market) panel associated with unique identifier. If the note does not exist, nothing will be changed and it will return false.
      Parameters:
      id - unique identifier for the note
      price - price for the note
      note - display text for the note
      style - text style including font background and text color
      Returns:
      true if the note exists and was updated
    • removeNote

      boolean removeNote(Object id)
      Removes the note from the DOM (Depth Of Market) panel with the given unique id. Returns true if the note existed and was successfully removed.
      Parameters:
      id - unique identifier for the note
      Returns:
      true if the note exists and was removed
    • removeAllNotes

      void removeAllNotes()
      Removes all notes from the DOM (Depth Of Market) panel that were created by the study.
    • clearBarWidths

      void clearBarWidths()
      Removes all custom bar widths for this study
    • setBarWidthAt

      void setBarWidthAt(int index, double barWidth)
      Sets a custom bar width for the given bar index.
      Parameters:
      index - index in the data series
      barWidth - custom bar width for the given index, use -1 to reset to the default bar width
    • getBarWidthAt

      double getBarWidthAt(int index)
      Gets the custom bar width for the given bar index.
      Parameters:
      index - index in the data series
      Returns:
      bar width at the given index