Class Settings
java.lang.Object
com.motivewave.platform.sdk.common.Settings
- All Implemented Interfaces:
Cloneable
Encapsulates the configuration information for a study or strategy.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a property change listener.void
addSession
(TimeFrame session) Adds a session to the strategy.void
clone()
Creates a clone (copy) of this object.boolean
Compares this settings object with the given object and returns true if they are equal.void
<T> T
<T> T
getBars()
Gets the set of all registered bar ids.Gets the bar info associated to the given id.getBarSize
(String id) Gets the bar size associated to the given id.Gets the set of all registered bar size ids.getBoolean
(String id) Gets the boolean value associated to the given id.boolean
getBoolean
(String id, boolean def) Gets the boolean value associated to the given id.Gets the color associated to the given id.Gets the color associated to the given id.getColorInfo
(String id) Gets the color info object associated to the given idGets the set of all registered color ids.Gets the SettingsDescriptor object that describes the user settings.Gets the double value associated to the given id.double
Gets the double value associated to the given id.<T> T
getExitPoint
(String id) Gets the exit point associated to the given id.Gets the set of all registered Exit Point ids.Gets the file associated with the given id.getFiles()
Gets the set of all registered file ids.Gets the font associated with the given id.getFonts()
Gets the set of all registered font ids.Gets the GuideInfo associated to the given idGets the set of all registered guide ids.getIndicator
(String id) Gets the indicator associated with the given idGet the set of all registered indicator ids.Gets the input associated to the given id.Gets the input key associated to the given id.Gets the set of all registered input ids.getInstrument
(String id) Gets the instrument associated to the given idGets the set of all registered instrument ids.getInteger
(String id) Gets the integer value associated to the given id.int
getInteger
(String id, int def) Gets the integer value associated to the given id.Gets the long value associated to the given id.getMAMethod
(String id) Gets the Moving Average Calculation method associated to the given idgetMAMethod
(String id, Enums.MAMethod def) Gets the Moving Average Calculation method associated to the given id.Gets the set of all registered Moving Average Method ids.Gets the MarkerInfo object associated with the given idGets the set of registered marker ids.getOrderType
(String id) Gets the order type associated to the given id.Gets the PathInfo object associated with the given idgetPaths()
Gets the set of all registered path idsIndicates position type to be used with the strategy (long, short or both).getPriceBar
(String id) Gets the bar info associated to the given id.Gets the set of all registered price bar ids.Gets the trading sessions (strategies only).getSetting
(String id) Gets the setting associated to the given id.Gets the ShadeInfo object associated to the given id.Gets the set of all registered shade ids.Gets the string value associated to the given id.Gets the string value associated to the given id.Gets the tif (Time In Force) value associated to the given id.getTimeFrame
(String id) Gets the timeframe associated to the given id.Gets the set of all registered time frame ids.Gets the time in force (TIF) for orders (strategies only).Gets the timezone for sessions (null for local time zone).int
Gets the number of trade lots to use (strategies only).Gets the set of value associated with the given key.Gets the set of value keys in the settings.boolean
boolean
boolean
Gets the boolean value associated to the given id.boolean
Gets the boolean value associated to the given id.boolean
Indicates if the strategy has auto entry enabled.boolean
Indicates if this study should respond to bar updates instead of only calculating on the close of the bar.boolean
Indicates if a position should be closed when the strategy is deactivated.boolean
Determines if this strategy should exit an open position automatically when a trading session closes.boolean
Indicates if a position should be opened when the strategy is activated.boolean
Determines if this strategy should enter automatically when a trading session opens.boolean
Gets the Trigger Outside Trading Hours attribute.boolean
Indicates if this study should use the existing position that is available on the account.protected void
void
Removes all property change listeners.void
Removes a property change listener.void
void
setAutoEntry
(boolean b) Sets the auto entry attribute for the strategy.void
Associates the given BarInfo to the specified id.void
setBarSize
(String id, BarSize barSize) Associates the given BarSize to the specified id.void
setBarUpdates
(boolean b) Indicates if this study should respond to bar updates instead of only calculating on the close of the bar.void
setBoolean
(String id, Boolean val) Associates the given boolean value to the specified id.void
setCloseOnDeactivate
(boolean b) Indicates if a position should be closed when the strategy is deactivated.void
setCloseOnSessionEnd
(boolean b) Sets the close position on session end attribute (this is called by the study framework).void
Associates the given Color to the specified id.void
Associates the given Color to the specified id.void
Sets the SettingsDescriptor object.void
Associates the given double value to the specified id.void
setEnterOnActivate
(boolean b) Indicates if a position should be opened when the strategy is activated.void
setEnterOnSessionStart
(boolean b) Sets the enter on session start attribute (this is called by the study framework).void
setExitPoint
(String id, ExitPoint ep) Associates the given ExitPoint to the specified id.void
Associates the given File to the specified id.void
Associates the given FontInfo to the specified id.void
Associates the given GuideInfo to the specified id.void
setIndicator
(String id, IndicatorInfo indicator) Associates the given IndicatorInfo to the specified id.void
Associates the given input key to the specified id.void
setInstrument
(String id, Instrument instrument) Associates the given Instrument to the specified id.void
setInteger
(String id, Integer val) Associates the given integer value to the specified id.void
Associates the given integer value to the specified id.void
setMAMethod
(String id, Enums.MAMethod method) Associates the given MAMethod to the specified id.void
setMarker
(String id, MarkerInfo marker) Associates the given MarkerInfo to the specified id.void
setOrderType
(String id, Enums.OrderType type) Associates the given OrderType to the specified id.void
Associates the given PathInfo to the specified id.void
Sets the position type for the strategy.void
setPriceBar
(String id, PriceBarInfo priceBar) Associates the given PriceBarInfo to the specified id.void
Associates the given ShadeInfo to the specified id.void
Associates the given string value to the specified id.void
setTbEditorNames
(List<String> ids) void
Associates the given TIF (time in force) to the specified id.void
setTimeFrame
(String id, TimeFrame tf) Associates the given TimeFrame to the specified id.void
setTimeInForce
(Enums.TIF tif) Sets the time in force (TIF) for orders (strategies only).void
setTimeZone
(TimeZone tz) Sets the timezone for sessions (null for local time zone).void
setTradeLots
(int tradeLots) Sets the number of trade lots to use (strategies only).void
setTriggerOTH
(boolean b) Sets the Trigger Outside Trading Hours attribute.void
setUseAccountPosition
(boolean b) Indicates if this study should use the existing position that is available on the account.void
toJson()
void
Updates the information from the given object.
-
Constructor Details
-
Settings
public Settings() -
Settings
-
-
Method Details
-
onUpdated
protected void onUpdated() -
setDescriptor
Sets the SettingsDescriptor object. This is called by the underlying study framework.- Parameters:
desc
- settings descriptor object
-
getDescriptor
Gets the SettingsDescriptor object that describes the user settings.- Returns:
- settings descriptor
-
getPath
Gets the PathInfo object associated with the given id- Parameters:
id
- id- Returns:
- the PathInfo associated to the given id.
-
setPath
Associates the given PathInfo to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the path (key)path
- path info object
-
getPaths
Gets the set of all registered path ids- Returns:
- a set of all the registered path ids.
-
getMarker
Gets the MarkerInfo object associated with the given id- Parameters:
id
- id used to identify the marker- Returns:
- the MarkerInfo associated to the given id.
-
setMarker
Associates the given MarkerInfo to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the markermarker
- marker info
-
getMarkers
Gets the set of registered marker ids.- Returns:
- a set of all the registered markers.
-
getIndicator
Gets the indicator associated with the given id- Parameters:
id
- id of the indicator- Returns:
- the IndicatorInfo associated to the given id.
-
setIndicator
Associates the given IndicatorInfo to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the indicatorindicator
- indicator info object
-
getIndicators
Get the set of all registered indicator ids.- Returns:
- a set of all the registered indicator ids.
-
getBars
Gets the bar info associated to the given id.- Parameters:
id
- id of the bar info- Returns:
- the BarInfo associated to the given id.
-
setBars
Associates the given BarInfo to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the bar infobar
- bar info object
-
getBars
Gets the set of all registered bar ids.- Returns:
- a set of all the registered bar ids.
-
getPriceBar
Gets the bar info associated to the given id.- Parameters:
id
- id of the bar info- Returns:
- the BarInfo associated to the given id.
-
setPriceBar
Associates the given PriceBarInfo to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the bar infopriceBar
- info object
-
getPriceBars
Gets the set of all registered price bar ids.- Returns:
- a set of all the registered price bar ids.
-
getShade
Gets the ShadeInfo object associated to the given id.- Parameters:
id
- id of the shade- Returns:
- the ShadeInfo associated to the given id.
-
setShade
Associates the given ShadeInfo to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the shadeshade
- shade info object
-
getShades
Gets the set of all registered shade ids.- Returns:
- a set of all the registered shade ids.
-
getGuide
Gets the GuideInfo associated to the given id- Parameters:
id
- id of the guide- Returns:
- the GuideInfo associated to the given id.
-
setGuide
Associates the given GuideInfo to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the guideguide
- guide info object
-
getGuides
Gets the set of all registered guide ids.- Returns:
- a set of all the registered guides.
-
getFont
Gets the font associated with the given id.- Parameters:
id
- id of the font- Returns:
- the FontInfo associated to the given id.
-
setFont
Associates the given FontInfo to the specified id. This is called by the underlying study framework.- Parameters:
id
- font idfont
- font info object
-
getFonts
Gets the set of all registered font ids.- Returns:
- a set of all the registered font ids.
-
getFile
Gets the file associated with the given id.- Parameters:
id
- id of the file- Returns:
- the file associated to the given id.
-
setFile
Associates the given File to the specified id. This is called by the underlying study framework.- Parameters:
id
- file idfile
- file object
-
getFiles
Gets the set of all registered file ids.- Returns:
- a set of all the registered file ids.
-
getColor
Gets the color associated to the given id.- Parameters:
id
- id of the color- Returns:
- the Color associated to the given id.
-
getColorInfo
Gets the color info object associated to the given id- Parameters:
id
- id of the color- Returns:
- the Color associated to the given id.
-
getColor
Gets the color associated to the given id. The default color is returned if the color is undefined (null).- Parameters:
id
- id of the colordef
- default value if the color is not defined- Returns:
- the Color associated to the given id. If the color is null, the default color 'def' is returned.
-
setColor
Associates the given Color to the specified id.- Parameters:
id
- id of the colorcolor
- color
-
setColor
Associates the given Color to the specified id.- Parameters:
id
- id of the colorcolor
- color info object
-
getColors
Gets the set of all registered color ids.- Returns:
- a set of all the registered color ids.
-
getInput
Gets the input associated to the given id.- Parameters:
id
- id of the input key- Returns:
- the input key associated to the given id.
-
getInput
Gets the input key associated to the given id. The 'def' value is returned if there is no input associated with the given id.- Parameters:
id
- id of the inputdef
- default to return if the input is undefined- Returns:
- the input key associated to the given id.
-
setInput
Associates the given input key to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the inputinput
- input key
-
getInputs
Gets the set of all registered input ids.- Returns:
- a set of all the registered input ids.
-
getMAMethod
Gets the Moving Average Calculation method associated to the given id- Parameters:
id
- id of the method- Returns:
- the MAMethod associated to the given id.
-
getMAMethod
Gets the Moving Average Calculation method associated to the given id. The given default value is returned if the method is not defined.- Parameters:
id
- id of the methoddef
- default value to return if the method is not defined- Returns:
- the MAMethod associated to the given id.
-
setMAMethod
Associates the given MAMethod to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the methodmethod
- moving average method
-
getMAMethods
Gets the set of all registered Moving Average Method ids.- Returns:
- a set of all the registered MAMethod ids.
-
getBarSize
Gets the bar size associated to the given id.- Parameters:
id
- id of the bar size- Returns:
- the BarSize associated to the given id.
-
setBarSize
Associates the given BarSize to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the bar sizebarSize
- bar size
-
getBarSizes
Gets the set of all registered bar size ids.- Returns:
- a set of all the registered BarSize ids.
-
getInstrument
Gets the instrument associated to the given id- Parameters:
id
- id of the instrument- Returns:
- the Instrument associated to the given id.
-
setInstrument
Associates the given Instrument to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the instrumentinstrument
- instrument to associate
-
getInstruments
Gets the set of all registered instrument ids.- Returns:
- a set of all the registered Instrument ids.
-
hasInstruments
public boolean hasInstruments()- Returns:
- true if instruments are defined
-
getExitPoint
Gets the exit point associated to the given id.- Parameters:
id
- id of the exit point- Returns:
- the ExitPoint associated to the given id.
-
setExitPoint
Associates the given ExitPoint to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the exit pointep
- exit point
-
getExitPoints
Gets the set of all registered Exit Point ids.- Returns:
- a set of all the registered ExitPoint ids.
-
getTimeFrame
Gets the timeframe associated to the given id.- Parameters:
id
- id of the timeframe- Returns:
- the TimeFrame associated to the given id.
-
setTimeFrame
Associates the given TimeFrame to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the timeframetf
- time frame to associate to the given id
-
getTimeFrames
Gets the set of all registered time frame ids.- Returns:
- a set of all the registered TimeFrame ids.
-
getOrderType
Gets the order type associated to the given id.- Parameters:
id
- id of the order type- Returns:
- the OrderType associated to the given id.
-
setOrderType
Associates the given OrderType to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the order typetype
- order type
-
getTIF
Gets the tif (Time In Force) value associated to the given id.- Parameters:
id
- id of the tif- Returns:
- time in force associated to the given id
-
setTIF
Associates the given TIF (time in force) to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the tiftif
- time in force
-
getValues
Gets the set of value keys in the settings.- Returns:
- set of value keys in the settings
-
getValue
Gets the set of value associated with the given key.- Parameters:
id
- id of the value- Returns:
- value associated to the given id
-
setValue
-
getEnum
-
get
-
get
-
set
-
getDouble
Gets the double value associated to the given id.- Parameters:
id
- id of the double value- Returns:
- double value associated to the given id
-
getDouble
Gets the double value associated to the given id. The def value is returned if the setting does not exist.- Parameters:
id
- id of the double valuedef
- default value to return if not defined- Returns:
- double value associated to the given id.
-
setDouble
Associates the given double value to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the double valueval
- double value
-
getInteger
Gets the integer value associated to the given id.- Parameters:
id
- id of the value- Returns:
- integer value associated to the given id
-
getInteger
Gets the integer value associated to the given id. The def value is returned if the setting does not exist.- Parameters:
id
- id of the integer valuedef
- default value to return if the id does not exist- Returns:
- integer value
-
setInteger
Associates the given integer value to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the valueval
- value to associate
-
getLong
Gets the long value associated to the given id.- Parameters:
id
- id of the value- Returns:
- long value associated to the given id
-
setLong
Associates the given integer value to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the valueval
- value to associate
-
getBoolean
Gets the boolean value associated to the given id.- Parameters:
id
- id of the value- Returns:
- associated boolean value
-
is
Gets the boolean value associated to the given id.- Parameters:
id
- id of the value- Returns:
- associated boolean value
-
has
-
is
Gets the boolean value associated to the given id.- Parameters:
id
- id of the valuedef
- default value if the current value is null- Returns:
- associated boolean value
-
getBoolean
Gets the boolean value associated to the given id. The def value is returned if the setting does not exist.- Parameters:
id
- id of the boolean valuedef
- default value to return if the id does not exist- Returns:
- boolean value
-
setBoolean
Associates the given boolean value to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the valueval
- value to associate
-
getString
Gets the string value associated to the given id.- Parameters:
id
- id of the value- Returns:
- String value associated to the given id
-
getString
Gets the string value associated to the given id. The 'def' value is returned if the value is not defined- Parameters:
id
- id of the string valuedef
- default value to return if the string does not exist- Returns:
- string value
-
setString
Associates the given string value to the specified id. This is called by the underlying study framework.- Parameters:
id
- id of the valueval
- string value to associate
-
getSetting
Gets the setting associated to the given id.- Parameters:
id
- id of the setting- Returns:
- the setting associated with the specified id.
-
update
Updates the information from the given object. This is called by the underlying study framework.- Parameters:
settings
- settings object
-
isBarUpdates
public boolean isBarUpdates()Indicates if this study should respond to bar updates instead of only calculating on the close of the bar.- Returns:
- true if bar updates is enabled.
-
setBarUpdates
public void setBarUpdates(boolean b) Indicates if this study should respond to bar updates instead of only calculating on the close of the bar.- Parameters:
b
- true if bar updates is enabled.
-
isUseAccountPosition
public boolean isUseAccountPosition()Indicates if this study should use the existing position that is available on the account.- Returns:
- true if the account position should be used.
-
setUseAccountPosition
public void setUseAccountPosition(boolean b) Indicates if this study should use the existing position that is available on the account.- Parameters:
b
- true if the account position should be used.
-
isAutoEntry
public boolean isAutoEntry()Indicates if the strategy has auto entry enabled.- Returns:
- true if auto entry is enabled
-
setAutoEntry
public void setAutoEntry(boolean b) Sets the auto entry attribute for the strategy.- Parameters:
b
- true if auto entry is enabled
-
getPositionType
Indicates position type to be used with the strategy (long, short or both).- Returns:
- position type
-
setPositionType
Sets the position type for the strategy.- Parameters:
p
- position type
-
isEnterOnActivate
public boolean isEnterOnActivate()Indicates if a position should be opened when the strategy is activated. This feature is only set if the strategy supports 'enter on activate' (see StudyHeader).- Returns:
- true if enter on activate is enabled
-
setEnterOnActivate
public void setEnterOnActivate(boolean b) Indicates if a position should be opened when the strategy is activated. This feature is only set if the strategy supports 'enter on activate' (see StudyHeader).- Parameters:
b
- true if enter on activate is enabled
-
isCloseOnDeactivate
public boolean isCloseOnDeactivate()Indicates if a position should be closed when the strategy is deactivated. This feature is only set if the strategy supports 'close on deactivate' (see StudyHeader).- Returns:
- true if close on deactivate is enabled
-
setCloseOnDeactivate
public void setCloseOnDeactivate(boolean b) Indicates if a position should be closed when the strategy is deactivated. This feature is only set if the strategy supports 'close on deactivate' (see StudyHeader).- Parameters:
b
- true if close on deactivate is enabled
-
setTimeInForce
Sets the time in force (TIF) for orders (strategies only).- Parameters:
tif
- time in force
-
getTimeInForce
Gets the time in force (TIF) for orders (strategies only).- Returns:
- time in force
-
setTradeLots
public void setTradeLots(int tradeLots) Sets the number of trade lots to use (strategies only).- Parameters:
tradeLots
- number of trade lots
-
getTradeLots
public int getTradeLots()Gets the number of trade lots to use (strategies only).- Returns:
- number of trade lots
-
getSessions
Gets the trading sessions (strategies only).- Returns:
- trading sessions
-
addSession
Adds a session to the strategy. This is called by the underlying study framework.- Parameters:
session
- trading session
-
clearSessions
public void clearSessions() -
isEnterOnSessionStart
public boolean isEnterOnSessionStart()Determines if this strategy should enter automatically when a trading session opens.- Returns:
- true if this strategy should enter automatically when a trading session opens.
-
setEnterOnSessionStart
public void setEnterOnSessionStart(boolean b) Sets the enter on session start attribute (this is called by the study framework).- Parameters:
b
- true if enter on session start is enabled
-
isCloseOnSessionEnd
public boolean isCloseOnSessionEnd()Determines if this strategy should exit an open position automatically when a trading session closes.- Returns:
- true if this strategy should exit an open position automatically when a trading session closes.
-
setCloseOnSessionEnd
public void setCloseOnSessionEnd(boolean b) Sets the close position on session end attribute (this is called by the study framework).- Parameters:
b
- true if the close position on session end is enabled
-
isTriggerOTH
public boolean isTriggerOTH()Gets the Trigger Outside Trading Hours attribute. If set to true, the order may be triggered outside regular trading hours.- Returns:
- true if orders can be triggered outside regular trading hours
-
setTriggerOTH
public void setTriggerOTH(boolean b) Sets the Trigger Outside Trading Hours attribute. If set to true, the order may be triggered outside regular trading hours.- Parameters:
b
- true if orders can be triggered outside regular trading hours
-
getTimeZone
Gets the timezone for sessions (null for local time zone).- Returns:
- timezone for sessions
-
setTimeZone
Sets the timezone for sessions (null for local time zone).- Parameters:
tz
- time zone
-
getTbEditorNames
-
setTbEditorNames
-
clone
Creates a clone (copy) of this object. -
equals
Compares this settings object with the given object and returns true if they are equal. -
addPropertyChangeListener
Adds a property change listener.- Parameters:
listener
- property change listener
-
removePropertyChangeListener
Removes a property change listener.- Parameters:
listener
- property change listener
-
removeAllPropertyChangeListeners
public void removeAllPropertyChangeListeners()Removes all property change listeners. -
fromJson
-
toJson
-