Class Settings
java.lang.Object
com.motivewave.platform.sdk.common.SettingsBase
com.motivewave.platform.sdk.common.Settings
- All Implemented Interfaces:
Cloneable
Encapsulates the configuration information for a study or strategy.
-
Field Summary
Fields inherited from class com.motivewave.platform.sdk.common.SettingsBase
descriptor, values -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSession(TimeFrame session) Adds a session to the strategy.voidprotected voidclone()Creates a clone (copy) of this object.booleanCompares this settings object with the given object and returns true if they are equal.voidgetBars()Gets the set of all registered bar ids.Gets the set of all registered bar size ids.getBoolean(String id) Gets the boolean value associated to the given id.booleangetBoolean(String id, boolean def) Gets the boolean value associated to the given id.Gets the set of all registered color ids.getExitPoint(String id) Gets the exit point associated to the given id.Gets the set of all registered Exit Point ids.getFiles()Gets the set of all registered file ids.getFonts()Gets the set of all registered font ids.Gets the set of all registered guide ids.Get the set of all registered indicator ids.Gets the set of all registered input ids.Gets the set of all registered instrument ids.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 set of registered marker ids.getOrderType(String id) Gets the order type associated to the given id.getPaths()Gets the set of all registered path idsIndicates position type to be used with the strategy (long, short or both).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 set of all registered shade ids.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).intGets the number of trade lots to use (strategies only).Gets the set of value keys in the settings.booleanbooleanIndicates if the strategy has auto entry enabled.booleanIndicates if this study should respond to bar updates instead of only calculating on the close of the bar.booleanIndicates if a position should be closed when the strategy is deactivated.booleanDetermines if this strategy should exit an open position automatically when a trading session closes.booleanIndicates if a position should be opened when the strategy is activated.booleanDetermines if this strategy should enter automatically when a trading session opens.booleanGets the Trigger Outside Trading Hours attribute.booleanIndicates if this study should use the existing position that is available on the account.voidsetAutoEntry(boolean b) Sets the auto entry attribute for the strategy.voidAssociates the given BarInfo to the specified id.voidsetBarUpdates(boolean b) Indicates if this study should respond to bar updates instead of only calculating on the close of the bar.voidsetBoolean(String id, Boolean val) Associates the given boolean value to the specified id.voidsetCloseOnDeactivate(boolean b) Indicates if a position should be closed when the strategy is deactivated.voidsetCloseOnSessionEnd(boolean b) Sets the close position on session end attribute (this is called by the study framework).voidAssociates the given Color to the specified id.voidAssociates the given Color to the specified id.voidAssociates the given double value to the specified id.voidsetEnterOnActivate(boolean b) Indicates if a position should be opened when the strategy is activated.voidsetEnterOnSessionStart(boolean b) Sets the enter on session start attribute (this is called by the study framework).voidsetExitPoint(String id, ExitPoint ep) Associates the given ExitPoint to the specified id.voidAssociates the given File to the specified id.voidAssociates the given FontInfo to the specified id.voidAssociates the given GuideInfo to the specified id.voidsetIndicator(String id, IndicatorInfo indicator) Associates the given IndicatorInfo to the specified id.voidsetInstrument(String id, Instrument instrument) Associates the given Instrument to the specified id.voidsetInteger(String id, Integer val) Associates the given integer value to the specified id.voidAssociates the given integer value to the specified id.voidsetMAMethod(String id, Enums.MAMethod method) Associates the given MAMethod to the specified id.voidsetMarker(String id, MarkerInfo marker) Associates the given MarkerInfo to the specified id.voidsetOrderType(String id, Enums.OrderType type) Associates the given OrderType to the specified id.voidAssociates the given PathInfo to the specified id.voidSets the position type for the strategy.voidsetPriceBar(String id, PriceBarInfo priceBar) Associates the given PriceBarInfo to the specified id.voidAssociates the given ShadeInfo to the specified id.voidAssociates the given string value to the specified id.voidsetTbEditorNames(List<String> ids) voidAssociates the given TIF (time in force) to the specified id.voidsetTimeFrame(String id, TimeFrame tf) Associates the given TimeFrame to the specified id.voidsetTimeInForce(Enums.TIF tif) Sets the time in force (TIF) for orders (strategies only).voidsetTimeZone(TimeZone tz) Sets the timezone for sessions (null for local time zone).voidsetTradeLots(int tradeLots) Sets the number of trade lots to use (strategies only).voidsetTriggerOTH(boolean b) Sets the Trigger Outside Trading Hours attribute.voidsetUseAccountPosition(boolean b) Indicates if this study should use the existing position that is available on the account.toJson()voidUpdates the information from the given object.Methods inherited from class com.motivewave.platform.sdk.common.SettingsBase
addListener, addPropertyChangeListener, get, get, getBars, getBarSize, getColor, getColor, getColorInfo, getDescriptor, getDouble, getDouble, getEnum, getEnum, getEnumInfo, getFile, getFont, getGuide, getIndicator, getInput, getInput, getInstrument, getInt, getInt, getInteger, getInteger, getLong, getMarker, getPath, getPoint2D, getPriceBar, getShade, getString, getString, getTextStyle, getValue, has, is, is, notifyProperty, notifyUpdated, notifyUpdatedLater, onUpdated, removeAllPropertyChangeListeners, removeListener, removePropertyChangeListener, set, setBarSize, setDescriptor, setInput, setValue, toJsonStr, update
-
Constructor Details
-
Settings
public Settings() -
Settings
-
-
Method Details
-
clearSets
protected void clearSets()- Overrides:
clearSetsin classSettingsBase
-
setPath
-
getPaths
-
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
-
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
-
setBars
-
getBars
-
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
-
setShade
-
getShades
-
setGuide
-
getGuides
-
setFont
-
getFonts
-
setFile
-
getFiles
-
setColor
-
setColor
-
getColors
-
getInputs
-
getMAMethod
Gets the Moving Average Calculation method associated to the given id- Overrides:
getMAMethodin classSettingsBase- 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.- Overrides:
getMAMethodin classSettingsBase- 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.- Overrides:
setMAMethodin classSettingsBase- Parameters:
id- id of the methodmethod- moving average method
-
getMAMethods
-
getBarSizes
-
setInstrument
Associates the given Instrument to the specified id. This is called by the underlying study framework.- Overrides:
setInstrumentin classSettingsBase- Parameters:
id- id of the instrumentinstrument- instrument to associate
-
getInstruments
-
hasInstruments
public boolean hasInstruments()- Returns:
- true if instruments are defined
-
getExitPoint
-
setExitPoint
-
getExitPoints
-
getTimeFrame
-
setTimeFrame
-
getTimeFrames
-
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
-
setTIF
-
getValues
-
setDouble
Associates the given double value to the specified id. This is called by the underlying study framework.- Overrides:
setDoublein classSettingsBase- Parameters:
id- id of the double valueval- double value
-
setInteger
-
setLong
-
getBoolean
-
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
-
setString
-
getSetting
-
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
-
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.- Overrides:
clonein classSettingsBase- Returns:
- clone of this object
-
equals
Compares this settings object with the given object and returns true if they are equal.- Overrides:
equalsin classSettingsBase- Parameters:
o- object to compare to- Returns:
- true if this object equals the given object
-
toJson
- Overrides:
toJsonin classSettingsBase
-
fromJson
- Overrides:
fromJsonin classSettingsBase
-