Class Study
java.lang.Object
com.motivewave.platform.sdk.study.Study
- All Implemented Interfaces:
Cloneable
This is the base class for all studies and strategies.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The Alt key modifier constant.static final int
The Control key modifier constant.static final int
The Meta key modifier constant (Mac Command Key).static final int
The Shift key modifier constant. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
Adds a figure to the start of the figure list for the default plot.protected final void
Adds a figure to the end of the figure list (for the default plot).protected final void
Adds a figure to the start of the figure list for the plot associated with the given plot name.protected final void
Adds a figure to the end of the figure list for the plot associated with the given plot name.protected final void
addFigureFront
(Figure figure) Adds a figure to the start of the figure list (for the default plot).protected final void
addFigureFront
(String plotName, Figure figure) Adds a figure to the start of the figure list for the plot associated with the given plot name.protected final void
addFigures
(String plotName, Collection<? extends Figure> figures) Adds a figure to the end of the figure list for the plot associated with the given plot name.protected final void
addFigures
(Collection<? extends Figure> figures) Adds a figure to the end of the figure list for the plot associated with the given plot name.void
Adds the given property change listener.void
addPropertyChangeListener
(String propertyName, PropertyChangeListener listener) Adds the given property change listener.void
protected void
calculate
(int index, DataContext ctx) Override this method to calculate the values at a specific index in the data series.protected void
By default, this method is called on events where the data series has been affected.protected final void
Clears the figures associated with this study (all figures).protected final void
clearFigures
(String plotName) Clears the figures associated with the given plot.void
Override this method to clear any internal state that may be kept within the study.clone()
Creates a clone (copy) of this study.final RuntimeDescriptor
createRD()
Convenience Method.final SettingsDescriptor
createSD()
Convenience Method.final boolean
crossedAbove
(DataSeries series, int index, Object key1, double val) Convenience Method.final boolean
crossedAbove
(DataSeries series, int index, Object key1, Object key2) Convenience Method.final boolean
crossedAbove
(Object key1, double val) Convenience Method.final boolean
crossedAbove
(Object key1, Object key2) Convenience Method.final boolean
crossedBelow
(DataSeries series, int index, Object key1, double val) Convenience Method.final boolean
crossedBelow
(DataSeries series, int index, Object key1, Object key2) Convenience Method.final boolean
crossedBelow
(Object key1, double val) Convenience Method.final boolean
crossedBelow
(Object key1, Object key2) Convenience Method.final void
Logs a debug message to the study log.void
destroy()
This method is called when the study is being disposed.void
final void
Logs an error message to the study log.protected void
firePropertyChange
(String propertyName, Object oldValue, Object newValue) Fires a property change event for the given property name if the newValue is different from the oldValuefinal String
format
(double d) Formats the give value as a displayable value on the graph.final String
Retrieves the locale dependent string from the resource bundle identified in the StudyHeader annotation.Gets the list of bar sizes required by this study.final Enums.EntryState
Gets the current entry state of this strategy.Gets the list of figures associated with the default plot.getFigures
(String plotName) Gets the list of figures associated with the plot with the given name.final StudyHeader
This convenience method gets the StudyHeader annotation defined for this study.Gets the list of instruments required by this study.getLabel()
Gets the display label for the default plot including setting values.Gets the display label for the given plot including setting values.int
Gets the minimum number of bars required to display this study.int
getMinBars
(DataContext ctx) Gets the minimum number of bars required to display this study.int
getMinBars
(DataContext ctx, BarSize bs) Gets the minimum number of bars required to display this study for the given bar size.Gets the minimum start time (milliseconds since 1970) required to display this study (null if no minimum is required)Gets the minimum start time (milliseconds since 1970) required to display this study (null if no minimum is required)getPopupMessage
(double x, double y, DrawContext ctx) Returns a message to display to the user when the mouse "hovers" over the study.final RuntimeDescriptor
Gets the 'runtime' descriptor.final Settings
Gets the user defined settings.final SettingsDescriptor
Gets the settings descriptor.final Enums.StrategyState
getState()
Gets the current state of this strategy.final Float
Gets the current stop price for an active strategy.final Float
Gets the current target price (exit price) for an active strategy.final void
Logs an info message to the study log.void
initialize
(Defaults defaults) This method is called to initialize the design and runtime settings.final boolean
returns true if the strategy is currently being cancelled.final boolean
isLong()
returns true if this strategy is 'long'.boolean
Indicates if a full repaint of the graph is necessary when the latest bar is updated.final boolean
isShort()
returns true if this strategy is 'short'.protected void
Sends a notification that the range for the study has been updated and the range for graph may need to be recomputed.protected void
Sends a notification that the study needs to be redrawn.protected void
Sends a notification that the values for the study have been updated and any dependent studies may need to get recomputed.void
onActivate
(OrderContext ctx) This method is called when the strategy is activated.void
onBarClose
(DataContext ctx) This method is called when the latest bar in the data series has been closed.void
onBarClose
(OrderContext ctx) This method is called when the current bar has been closed.void
onBarOpen
(DataContext ctx) This method is called when the latest bar in the data series is first opened.void
onBarOpen
(OrderContext ctx) This method is called when the current bar is first opened.void
onBarUpdate
(DataContext ctx) This method is called when the latest bar in the data series has been updated.void
onBarUpdate
(OrderContext ctx) This method is called when the current bar has been updated.void
onBeginResize
(ResizePoint rp, DrawContext ctx) This method is called when a user begins to move a resize point.boolean
This method is called when the user clicks on a study.void
This method is called when the start and end indices of the data series have changed.void
This method is called when additional historical data is loaded into the data series or when a new bar has been added to the data series.void
onDeactivate
(OrderContext ctx) This method is called when the strategy is deactivated.boolean
onDoubleClick
(Point p, int flags) This method is called when the user double clicks on a study.void
onEndResize
(ResizePoint rp, DrawContext ctx) This method is called when a user completes a movement of a resize point.void
onEnterNow
(OrderContext ctx) This method is called on response to the 'Enter Now' button on the strategy panel.void
This method is called when the study is first loaded and before the data is loaded.onMenu
(String plotName, Point loc, DrawContext ctx) Override this method to provide a custom context menu, when a popup trigger (right click) is detected on this study.void
This method is called when a new data series is created.void
onOrderCancelled
(OrderContext ctx, Order order) This method is called when an order is cancelled.void
onOrderFilled
(OrderContext ctx, Order order) This method is called when an order is filled.void
onOrderModified
(OrderContext ctx, Order order) This method is called when an order is cancelled.void
onOrderRejected
(OrderContext ctx, Order order) This method is called when an order is rejected.void
This method is called when the current open position is closed.void
onReset
(OrderContext ctx) This method is called when the strategy is reset.void
onResize
(ResizePoint rp, DrawContext ctx) This method is called whenever the user moves the resize point.void
onSessionEnded
(OrderContext ctx, TimeFrame session) This method is called when a trading session is ended.void
onSessionStarted
(OrderContext ctx, TimeFrame session) This method is called when a trading session is started.void
This method is called whenever the settings for the study have been updated.void
onSignal
(OrderContext ctx, Object signalKey) This method is called when a signal is generated by the study.void
onTick
(DataContext ctx, Tick tick) This method is called when a tick (trade) occurs.boolean
onWheelMoved
(Point p, int delta, int flags) This method is called when the user moves the mouse wheel while the mouse is above the study.protected void
postcalculate
(DataContext ctx) Override this method to perform work after calculate and calculateValues() is called.protected void
precalculate
(DataContext ctx) Override this method to perform work before calculate and calculateValues() is called.protected final void
removeFigure
(Figure figure) Removes the given figure from the figure list for the default plot (if it exists).protected final void
removeFigure
(String plotName, Figure figure) Removes the given figure from the figure list for the plot associated with the given name.protected final void
removeFigures
(String plotName, Collection<? extends Figure> figures) Removes the given figures from the figure list for the plot associated with the given name.protected final void
removeFigures
(Collection<? extends Figure> figures) Removes the given figures from the figure list for the default plot.void
Removes the given property listener.void
removePropertyChangeListener
(String propertyName, PropertyChangeListener listener) Removes the given property listener for the given propertyName.final double
round
(double d) Rounds the give value to the minimum value displayable on the graph.final void
setCancelInProgress
(boolean b) Sets the cancel in progress state for this strategyfinal void
This method is called by the study framework and should not be used.final void
setEntryState
(Enums.EntryState state) Sets the current state of this strategy.protected final void
setFigures
(String plotName, List<? extends Figure> figures) Adds a figure to the end of the figure list for the plot associated with the given plot name.protected final void
setFigures
(List<? extends Figure> figures) final void
Sets this strategy as "long' (if true)void
setMinBars
(int bars) Sets the minimum number of bars required to display this study.void
setMinBars
(int bars, BarSize bs) Sets the minimum number of bars required to display this study.void
setMinStartTime
(Long time) Sets the minimum start time (milliseconds since 1970) to display this study (null if no minimum is required)final void
Sets the 'runtime' descriptor.final void
setSettings
(Settings settings) Sets the user defined settings.final void
Sets the settings descriptor.final void
setState
(Enums.StrategyState state) Sets the current state of this strategy.final void
setStopPrice
(Float price) Sets the stop price for the active strategy.final void
setTargetPrice
(Float price) Sets the target price for the active strategy.void
setVetoCloseOnDeactivate
(boolean b) final void
Logs a warning message to the study log.
-
Field Details
-
SHIFT_DOWN
public static final int SHIFT_DOWNThe Shift key modifier constant.- See Also:
-
CTRL_DOWN
public static final int CTRL_DOWNThe Control key modifier constant.- See Also:
-
META_DOWN
public static final int META_DOWNThe Meta key modifier constant (Mac Command Key).- See Also:
-
ALT_DOWN
public static final int ALT_DOWNThe Alt key modifier constant.- See Also:
-
-
Constructor Details
-
Study
public Study()
-
-
Method Details
-
initialize
This method is called to initialize the design and runtime settings.- Parameters:
defaults
- system defaults
-
onLoad
This method is called when the study is first loaded and before the data is loaded. This can be a useful place to set the minimum number of bars to calculate the study.- Parameters:
defaults
- system defaults
-
precalculate
Override this method to perform work before calculate and calculateValues() is called.- Parameters:
ctx
- data context
-
postcalculate
Override this method to perform work after calculate and calculateValues() is called.- Parameters:
ctx
- data context
-
calculate
Override this method to calculate the values at a specific index in the data series. This method is called from calculateValues(ctx) and onBarUpdate(ctx)- Parameters:
index
- index in the data seriesctx
- Data Context
-
calculateValues
By default, this method is called on events where the data series has been affected.- Parameters:
ctx
- data context
-
isRepaintAllOnUpdate
public boolean isRepaintAllOnUpdate()Indicates if a full repaint of the graph is necessary when the latest bar is updated. By default this returns false. If your study needs other parts (outside of the latest bar) to be repainted when the bar is updated, consider returning true.- Returns:
- true if a full repaint of the graph is required when the bar is updated
-
onBarOpen
This method is called when the latest bar in the data series is first opened. By default, this method calls onBarUpdate(ctx)- Parameters:
ctx
- data context
-
onBarUpdate
This method is called when the latest bar in the data series has been updated.- Parameters:
ctx
- data context
-
onTick
This method is called when a tick (trade) occurs.- Parameters:
tick
- latest tick (trade)
-
onBarClose
This method is called when the latest bar in the data series has been closed. By default, this method calls onBarUpdate(ctx)- Parameters:
ctx
- data context
-
onDataSeriesMoved
This method is called when the start and end indices of the data series have changed.- Parameters:
ctx
- data context
-
onDataSeriesUpdated
This method is called when additional historical data is loaded into the data series or when a new bar has been added to the data series. Please Note: this may change the indices of the data stored in the set. The data stored on the series will be preserved as it is stored by the start times of the individual bars.- Parameters:
ctx
- data context
-
onNewDataSeries
This method is called when a new data series is created. Typically this occurs when the user changes the interval on the graph.- Parameters:
ctx
- data context
-
onSettingsUpdated
This method is called whenever the settings for the study have been updated.- Parameters:
ctx
- data context
-
onMenu
Override this method to provide a custom context menu, when a popup trigger (right click) is detected on this study.- Parameters:
plotName
- name of the plot where this event occurredloc
- x,y coordinates of the mouse location where event occurred- Returns:
- MenuDescriptor
-
onBeginResize
This method is called when a user begins to move a resize point.- Parameters:
rp
- resize point that is about to be moved.ctx
- draw context for the chart that is affected.
-
onResize
This method is called whenever the user moves the resize point. It is called between the onBeginResize() and onEndResize() events.- Parameters:
rp
- resize point that is being moved.ctx
- draw context for the chart that is affected.
-
onEndResize
This method is called when a user completes a movement of a resize point. On completion of this method, the study will be recalculated. This will also affect other charts that have an instance of this study.- Parameters:
rp
- resize point was resized.ctx
- draw context for the chart that is affected.
-
onDoubleClick
This method is called when the user double clicks on a study.- Parameters:
p
- x and y location where the user double clickedflags
- indicators of modifier keys pressed- Returns:
- true if the default behavior should be executed (display study dialog)
-
onClick
This method is called when the user clicks on a study.- Parameters:
p
- x and y location where the user clickedflags
- indicators of modifier keys pressed- Returns:
- true if the default behavior should be executed
-
onWheelMoved
This method is called when the user moves the mouse wheel while the mouse is above the study.- Parameters:
p
- x and y coordinate where the mouse is locateddelta
- direction and amount the wheel was movedflags
- indicators of modifier keys pressed- Returns:
- true if the default behavior should be executed
-
clearState
public void clearState()Override this method to clear any internal state that may be kept within the study. This method is called when the settings have been updated, the user chooses a new bar size or when additional historical data is loaded into the series -
createRD
Convenience Method. Creates a RuntimeDescriptor and set it on this study- Returns:
- RuntimeDescriptor
-
getRuntimeDescriptor
Gets the 'runtime' descriptor. This object describes the runtime characteristics of the study.- Returns:
- runtime descriptor
-
setRuntimeDescriptor
Sets the 'runtime' descriptor. This object describes the runtime characteristics of the study.- Parameters:
desc
- runtime descriptor object
-
createSD
Convenience Method. Creates a SettingDescriptor and set it on this study- Returns:
- SettingsDescriptor
-
getSettingsDescriptor
Gets the settings descriptor. This object describes the design time characteristics of the study.- Returns:
- settings descriptor
-
setSettingsDescriptor
Sets the settings descriptor. This object describes the design time characteristics of the study.- Parameters:
sd
- descriptor object
-
getSettings
Gets the user defined settings.- Returns:
- user defined settings
-
setSettings
Sets the user defined settings. This method is called by the SDK framework and should not be called within the study code.- Parameters:
settings
-
-
getBarSizes
Gets the list of bar sizes required by this study. By default, this method will return all of the bar sized defined in the settings. If a descriptor is defined for the bar size, it will check to see if the descriptor is enabled before adding the bar size.- Returns:
- list of bar sizes required by this study
-
getInstruments
Gets the list of instruments required by this study. By default, this method will return all of the instruments defined in the settings. If a descriptor is defined for the instrument, it will check to see if the descriptor is enabled before adding the instrument.- Returns:
- list of instruments required by this study
-
getPopupMessage
Returns a message to display to the user when the mouse "hovers" over the study. By default, this method will iterate through figures and return the first non-empty message from a figure that contains the given x and y coordinates.- Parameters:
x
- x coordinatey
- y coordinate- Returns:
- message to display to the user when the mouse is over given (x,y) coordinate.
-
getHeader
This convenience method gets the StudyHeader annotation defined for this study.- Returns:
- study header
-
getLabel
Gets the display label for the default plot including setting values.- Returns:
- display label for the default plot including setting values
-
getLabel
Gets the display label for the given plot including setting values.- Parameters:
plotName
- name of the study plot- Returns:
- display label
-
clearFigures
protected final void clearFigures()Clears the figures associated with this study (all figures). -
clearFigures
Clears the figures associated with the given plot.- Parameters:
plotName
- name of the study plot
-
addFigure
Adds a figure to the end of the figure list (for the default plot).- Parameters:
figure
- figure to add
-
setFigures
-
addFigureFront
Adds a figure to the start of the figure list (for the default plot).- Parameters:
figure
- figure to add
-
addFigure
Adds a figure to the end of the figure list for the plot associated with the given plot name.- Parameters:
plotName
- name of the study plotfigure
- figure to add
-
setFigures
Adds a figure to the end of the figure list for the plot associated with the given plot name.- Parameters:
plotName
- name of the study plotfigure
- figure to add
-
addFigures
Adds a figure to the end of the figure list for the plot associated with the given plot name.- Parameters:
figures
- figures to add
-
addFigures
Adds a figure to the end of the figure list for the plot associated with the given plot name.- Parameters:
plotName
- name of the study plotfigures
- figures to add
-
addFigure
Adds a figure to the start of the figure list for the default plot.- Parameters:
index
- position in the list to addfigure
- figure to add
-
addFigure
Adds a figure to the start of the figure list for the plot associated with the given plot name.- Parameters:
plotName
- name of the study plotindex
- position in the list to addfigure
- figure to add
-
addFigureFront
Adds a figure to the start of the figure list for the plot associated with the given plot name.- Parameters:
plotName
- name of the study plotfigure
- figure to add
-
removeFigure
Removes the given figure from the figure list for the default plot (if it exists).- Parameters:
figure
- figure to remove
-
removeFigure
Removes the given figure from the figure list for the plot associated with the given name.- Parameters:
plotName
- name of the study plotfigure
- figure to remove
-
removeFigures
Removes the given figures from the figure list for the default plot.- Parameters:
figures
- figures to remove
-
removeFigures
Removes the given figures from the figure list for the plot associated with the given name.- Parameters:
plotName
- name of the study plotfigures
- figures to remove
-
getFigures
Gets the list of figures associated with the default plot.- Returns:
- list of figures associated with the default plot
-
getFigures
Gets the list of figures associated with the plot with the given name.- Parameters:
plotName
- name of the study plot- Returns:
- list of figures associated with the given plot name
-
getMinBars
public int getMinBars()Gets the minimum number of bars required to display this study.- Returns:
- minimum number of bars required to display the study
-
getMinBars
Gets the minimum number of bars required to display this study.- Parameters:
ctx
- data context- Returns:
- minimum number of bars required to display the study
-
getMinBars
Gets the minimum number of bars required to display this study for the given bar size.- Parameters:
ctx
- data contextbs
- bar size- Returns:
- minimum number of bars required to display the study
-
setMinBars
public void setMinBars(int bars) Sets the minimum number of bars required to display this study.- Parameters:
bars
- minimum number of bars
-
setMinBars
Sets the minimum number of bars required to display this study.- Parameters:
bars
- minimum number of barsbs
- bar size
-
getMinStartTime
Gets the minimum start time (milliseconds since 1970) required to display this study (null if no minimum is required)- Returns:
- minimum start time required to display this study (null if no minimum is required).
-
getMinStartTime
Gets the minimum start time (milliseconds since 1970) required to display this study (null if no minimum is required)- Parameters:
ctx
- data context- Returns:
- minimum start time required to display this study (null if no minimum is required).
-
setMinStartTime
Sets the minimum start time (milliseconds since 1970) to display this study (null if no minimum is required)- Parameters:
time
- minimum start time (milliseconds since 1970)
-
onActivate
This method is called when the strategy is activated.- Parameters:
ctx
- order context
-
onSessionStarted
This method is called when a trading session is started.- Parameters:
ctx
- order contextsession
- time frame
-
onSessionEnded
This method is called when a trading session is ended.- Parameters:
ctx
- order contextsession
- time frame session
-
onBarOpen
This method is called when the current bar is first opened. By default, this method calls onBarUpdate(ctx).- Parameters:
ctx
- order context
-
onBarUpdate
This method is called when the current bar has been updated.- Parameters:
ctx
- order context
-
onBarClose
This method is called when the current bar has been closed. By default, this method calls onBarUpdate(ctx).- Parameters:
ctx
- order context
-
onSignal
This method is called when a signal is generated by the study. This method will be called even if the signal is not enabled in the study settings.- Parameters:
ctx
- order contextsignalKey
-
-
onDeactivate
This method is called when the strategy is deactivated.- Parameters:
ctx
- order context
-
setVetoCloseOnDeactivate
public void setVetoCloseOnDeactivate(boolean b) -
onReset
This method is called when the strategy is reset.- Parameters:
ctx
- order context
-
onPositionClosed
This method is called when the current open position is closed.- Parameters:
ctx
- order context
-
onEnterNow
This method is called on response to the 'Enter Now' button on the strategy panel. This is for manual entry strategies only.- Parameters:
ctx
- order context
-
onOrderFilled
This method is called when an order is filled.- Parameters:
ctx
- order contextorder
- order that was filled
-
onOrderCancelled
This method is called when an order is cancelled.- Parameters:
ctx
- order contextorder
- order that was cancelled
-
onOrderRejected
This method is called when an order is rejected.- Parameters:
ctx
- order contextorder
- order that was rejected
-
onOrderModified
This method is called when an order is cancelled. -
getState
Gets the current state of this strategy.- Returns:
- current state of this strategy
-
setState
Sets the current state of this strategy.- Parameters:
state
- strategy state
-
getEntryState
Gets the current entry state of this strategy.- Returns:
- current entry state of this strategy
-
setEntryState
Sets the current state of this strategy.- Parameters:
state
- entry state
-
isLong
public final boolean isLong()returns true if this strategy is 'long'.- Returns:
- true if this strategy is 'long'
-
isShort
public final boolean isShort()returns true if this strategy is 'short'.- Returns:
- true if this strategy is 'short'
-
setLong
Sets this strategy as "long' (if true)- Parameters:
b
- flag that indicates if this strategy is long
-
isCancelInProgress
public final boolean isCancelInProgress()returns true if the strategy is currently being cancelled.- Returns:
- true if this strategy is currently being cancelled
-
setCancelInProgress
public final void setCancelInProgress(boolean b) Sets the cancel in progress state for this strategy- Parameters:
b
- true if this strategy is being cancelled
-
getStopPrice
Gets the current stop price for an active strategy. This may be used to calculate the stop profit/loss (null if there is no stop price).- Returns:
- current stop price for an active strategy
-
setStopPrice
Sets the stop price for the active strategy. Use null to indicate that there is no stop.- Parameters:
price
- stop price
-
getTargetPrice
Gets the current target price (exit price) for an active strategy. This may be used to calculate the target profit/loss (null if there is no target price).- Returns:
- current target price for this strategy
-
setTargetPrice
Sets the target price for the active strategy. Use null to indicate that there is no target.- Parameters:
price
- target price (null for no target)
-
setDataContext
This method is called by the study framework and should not be used. -
getDataContext
-
get
Retrieves the locale dependent string from the resource bundle identified in the StudyHeader annotation.- Parameters:
ID
- identifier in the resource bundle- Returns:
- locale dependent string with parameter substitutions
-
round
public final double round(double d) Rounds the give value to the minimum value displayable on the graph. If this is an overlay, it calls Instrument.round(d) for the for instrument in the data context. If this is not an overlay the value is rounded using the minTick value set on the RuntimeDescriptor.- Parameters:
d
- the value to round- Returns:
- the value d rounded to the min value displayable on the graph
-
format
Formats the give value as a displayable value on the graph. If this is an overlay, it calls Instrument.format(d) for the for instrument in the data context. If this is not an overlay the value is rounded using the minTick value set on the RuntimeDescriptor.- Parameters:
d
- the value to round
-
crossedAbove
Convenience Method. Checks to see if the series of values defined by key1 has crossed above the series of values defined by key2 (using the latest value of the default data series). This occurs if round(series.getDouble(index, key1)) > round(series.getDouble(index, key2)) AND round(series.getDouble(index-1, key2)) < round(series.getDouble(index-1, key2))- Parameters:
key1
- key that identifies the first series of valueskey2
- key that identifies the second series of values- Returns:
- true if the series key1 crossed above series key2
-
crossedAbove
Convenience Method. Checks to see if the series of values defined by key1 has crossed above the series of values defined by key2. This occurs if round(series.getDouble(index, key1)) > round(series.getDouble(index, key2)) AND round(series.getDouble(index-1, key2)) < round(series.getDouble(index-1, key2))- Parameters:
series
- series that contains the valuesindex
- index in the data serieskey1
- key that identifies the first series of valueskey2
- key that identifies the second series of values- Returns:
- true if the series key1 crossed above series key2
-
crossedAbove
Convenience Method. Checks to see if the series of values defined by key1 has crossed above the value 'val' (using the latest value of the default data series).- Parameters:
key1
- key that identifies the first series of valuesval
- value to cross above- Returns:
- true if the series key1 crossed above val
-
crossedAbove
Convenience Method. Checks to see if the series of values defined by key1 has crossed above the value 'val'.- Parameters:
series
- series that contains the valuesindex
- index in the data serieskey1
- key that identifies the first series of valuesval
- value to cross above- Returns:
- true if the series key1 crossed above val
-
crossedBelow
Convenience Method. Checks to see if the series of values defined by the key key1 has crossed below the series of values defined by key2 (using the latest index in the default data series). This occurs if round(series.getDouble(index, key1)) < round(series.getDouble(index, key2)) AND round(series.getDouble(index-1, key1)) > round(series.getDouble(index-1, key2))- Parameters:
key1
- key that identifies the first series of valueskey2
- key that identifies the second series of values- Returns:
- true if the series key1 crossed below series key2
-
crossedBelow
Convenience Method. Checks to see if the series of values defined by the key key1 has crossed below the series of values defined by key2. This occurs if round(series.getDouble(index, key1)) < round(series.getDouble(index, key2)) AND round(series.getDouble(index-1, key1)) > round(series.getDouble(index-1, key2))- Parameters:
series
- series that contains the valuesindex
- index in the data serieskey1
- key that identifies the first series of valueskey2
- key that identifies the second series of values- Returns:
- true if the series key1 crossed below series key2
-
crossedBelow
Convenience Method. Checks to see if the series of values defined by key1 has crossed below the value 'val' (using the latest value of the default data series).- Parameters:
key1
- key that identifies the first series of valuesval
- value to cross below- Returns:
- true if the series key1 crossed below val
-
crossedBelow
Convenience Method. Checks to see if the series of values defined by key1 has crossed below the value 'val'.- Parameters:
series
- series that contains the valuesindex
- index in the data serieskey1
- key that identifies the first series of valuesval
- value to cross below- Returns:
- true if the series key1 crossed below val
-
debug
Logs a debug message to the study log.- Parameters:
msg
- debug message
-
info
Logs an info message to the study log.- Parameters:
msg
- info message
-
warning
Logs a warning message to the study log.- Parameters:
msg
- warning message
-
error
Logs an error message to the study log.- Parameters:
msg
- error message
-
addPropertyChangeListener
Adds the given property change listener. This listener will receive property change events for all properties.- Parameters:
listener
- property change listener
-
addPropertyChangeListener
Adds the given property change listener. This listener will only receive property change events for the given propertyName.- Parameters:
propertyName
- name of the propertylistener
- property change listener
-
removePropertyChangeListener
Removes the given property listener.- Parameters:
listener
- property change listener
-
removePropertyChangeListener
Removes the given property listener for the given propertyName.- Parameters:
propertyName
- name of the propertylistener
- property change listener
-
firePropertyChange
Fires a property change event for the given property name if the newValue is different from the oldValue- Parameters:
propertyName
- name of the propertyoldValue
- old (previous) value for this propertynewValue
- new value for the property
-
destroy
public void destroy()This method is called when the study is being disposed. This method should be used to release and resources (if any). -
notifyRangeUpdated
protected void notifyRangeUpdated()Sends a notification that the range for the study has been updated and the range for graph may need to be recomputed. -
notifyValuesUpdated
protected void notifyValuesUpdated()Sends a notification that the values for the study have been updated and any dependent studies may need to get recomputed. -
notifyRedraw
protected void notifyRedraw()Sends a notification that the study needs to be redrawn. -
clone
Creates a clone (copy) of this study. -
beginFigureUpdate
public void beginFigureUpdate() -
endFigureUpdate
public void endFigureUpdate()
-