Interface DataContext
public interface DataContext
This context provides an access point to services relating to data.
- 
Method SummaryModifier and TypeMethodDescriptionAdds 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 ObjectAdds a note to the DOM (Depth of Market) panel using the default font and text color.voidRemoves all custom bar widths for this studyvoidclearSignal(int index, Object signalKey) Clears the signal flag for the given index.doublegetBarWidthAt(int index) Gets the custom bar width for the given bar index.Gets the current bar size for the underlying chart.longGets the current time.Gets the primary data series.getDataSeries(BarSize barSize) 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.booleanChecks to see if the system is currently loading historical data.booleanChecks if the current context is in replay modebooleanisRTH()Returns true if the historical data is regular trading hours (vs extended hours).booleanisSignalEnabled(Object signalKey) Checks to see if the signal with the given key is enabled.voidRemoves all notes from the DOM (Depth Of Market) panel that were created by the study.booleanremoveNote(Object id) Removes the note from the DOM (Depth Of Market) panel with the given unique id.voidsetBarWidthAt(int index, double barWidth) Sets a custom bar width for the given bar index.voidTriggers a signal with the given key, message and value.booleanupdateNote(Object id, float price, String note, TextStyle style) Updates the note in the DOM (Depth of Market) panel associated with unique identifier.
- 
Method Details- 
getDataSeriesDataSeries getDataSeries()Gets the primary data series.- Returns:
- primary data series for this study.
 
- 
getChartBarSizeBarSize getChartBarSize()Gets the current bar size for the underlying chart.- Returns:
- the current bar size for the underlying chart
 
- 
getDataSeriesGets additional data series objects of a different bar size.- Parameters:
- barSize- barSize for the data series
- Returns:
- data series of the given bar size.
 
- 
getInstrumentInstrument getInstrument()Gets the instrument associated with this context.- Returns:
- instrument associated with this context.
 
- 
getTradeInstrumentInstrument 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.
 
- 
getInstrumentsList<Instrument> getInstruments()Gets the instruments associated with this context.- Returns:
- instruments associated with this context.
 
- 
signalTriggers 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)
 
- 
clearSignalClears the signal flag for the given index. This may be used to trigger multiple signals on a bar.- Parameters:
- index-
- signalKey-
 
- 
isSignalEnabledChecks 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
 
- 
isRTHboolean isRTH()Returns true if the historical data is regular trading hours (vs extended hours).- Returns:
- true if this is regular trading hours (rth).
 
- 
getCurrentTimelong 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)
 
- 
getTimeZoneTimeZone getTimeZone()Gets the time zone for the underlying chart.- Returns:
- time zone set for the underlying chart
 
- 
getDefaults
- 
isLoadingDataboolean isLoadingData()Checks to see if the system is currently loading historical data.- Returns:
- true if the system is currently loading data.
 
- 
isReplayModeboolean isReplayMode()Checks if the current context is in replay mode- Returns:
- true if Replay Mode is enabled
 
- 
addNoteAdds 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
 
- 
addNoteAdds 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
 
- 
updateNoteUpdates 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
 
- 
removeNoteRemoves 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
 
- 
removeAllNotesvoid removeAllNotes()Removes all notes from the DOM (Depth Of Market) panel that were created by the study.
- 
clearBarWidthsvoid clearBarWidths()Removes all custom bar widths for this study
- 
setBarWidthAtvoid 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
 
- 
getBarWidthAtdouble 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
 
 
-