Class Settings

java.lang.Object
com.motivewave.platform.sdk.common.Settings
All Implemented Interfaces:
Cloneable

public class Settings extends Object implements Cloneable
Encapsulates the configuration information for a study or strategy.
  • Constructor Details

    • Settings

      public Settings()
  • Method Details

    • setDescriptor

      public void setDescriptor(SettingsDescriptor desc)
      Sets the SettingsDescriptor object. This is called by the underlying study framework.
      Parameters:
      desc - settings descriptor object
    • getDescriptor

      public SettingsDescriptor getDescriptor()
      Gets the SettingsDescriptor object that describes the user settings.
      Returns:
      settings descriptor
    • getPath

      public PathInfo getPath(String name)
      Gets the PathInfo object associated with the given name
      Parameters:
      name - name
      Returns:
      the PathInfo associated to the given name.
    • setPath

      public void setPath(String name, PathInfo path)
      Associates the given PathInfo to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the path (key)
      path - path info object
    • getPaths

      public Set<String> getPaths()
      Gets the set of all registered path names
      Returns:
      a set of all the registered path names.
    • getMarker

      public MarkerInfo getMarker(String name)
      Gets the MarkerInfo object associated with the given name
      Parameters:
      name - name used to identify the marker
      Returns:
      the MarkerInfo associated to the given name.
    • setMarker

      public void setMarker(String name, MarkerInfo marker)
      Associates the given MarkerInfo to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the marker
      marker - marker info
    • getMarkers

      public Set<String> getMarkers()
      Gets the set of registered marker names.
      Returns:
      a set of all the registered markers.
    • getIndicator

      public IndicatorInfo getIndicator(String name)
      Gets the indicator associated with the given name
      Parameters:
      name - name of the indicator
      Returns:
      the IndicatorInfo associated to the given name.
    • setIndicator

      public void setIndicator(String name, IndicatorInfo indicator)
      Associates the given IndicatorInfo to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the indicator
      indicator - indicator info object
    • getIndicators

      public Set<String> getIndicators()
      Get the set of all registered indicator names.
      Returns:
      a set of all the registered indicator names.
    • getBars

      public BarInfo getBars(String name)
      Gets the bar info associated to the given name.
      Parameters:
      name - name of the bar info
      Returns:
      the BarInfo associated to the given name.
    • setBars

      public void setBars(String name, BarInfo bar)
      Associates the given BarInfo to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the bar info
      bar - bar info object
    • getBars

      public Set<String> getBars()
      Gets the set of all registered bar names.
      Returns:
      a set of all the registered bar names.
    • getPriceBar

      public PriceBarInfo getPriceBar(String name)
      Gets the bar info associated to the given name.
      Parameters:
      name - name of the bar info
      Returns:
      the BarInfo associated to the given name.
    • setPriceBar

      public void setPriceBar(String name, PriceBarInfo priceBar)
      Associates the given PriceBarInfo to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the bar info
      priceBar - info object
    • getPriceBars

      public Set<String> getPriceBars()
      Gets the set of all registered price bar names.
      Returns:
      a set of all the registered price bar names.
    • getShade

      public ShadeInfo getShade(String name)
      Gets the ShadeInfo object associated to the given name.
      Parameters:
      name - name of the shade
      Returns:
      the ShadeInfo associated to the given name.
    • setShade

      public void setShade(String name, ShadeInfo shade)
      Associates the given ShadeInfo to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the shade
      shade - shade info object
    • getShades

      public Set<String> getShades()
      Gets the set of all registered shade names.
      Returns:
      a set of all the registered shade names.
    • getGuide

      public GuideInfo getGuide(String name)
      Gets the GuideInfo associated to the given name
      Parameters:
      name - name of the guide
      Returns:
      the GuideInfo associated to the given name.
    • setGuide

      public void setGuide(String name, GuideInfo guide)
      Associates the given GuideInfo to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the guide
      guide - guide info object
    • getGuides

      public Set<String> getGuides()
      Gets the set of all registered guide names.
      Returns:
      a set of all the registered guides.
    • getFont

      public FontInfo getFont(String name)
      Gets the font associated with the given name.
      Parameters:
      name - name of the font
      Returns:
      the FontInfo associated to the given name.
    • setFont

      public void setFont(String name, FontInfo font)
      Associates the given FontInfo to the specified name. This is called by the underlying study framework.
      Parameters:
      name - font name
      font - font info object
    • getFonts

      public Set<String> getFonts()
      Gets the set of all registered font names.
      Returns:
      a set of all the registered font names.
    • getFile

      public File getFile(String name)
      Gets the file associated with the given name.
      Parameters:
      name - name of the file
      Returns:
      the file associated to the given name.
    • setFile

      public void setFile(String name, File file)
      Associates the given File to the specified name. This is called by the underlying study framework.
      Parameters:
      name - file name
      file - file object
    • getFiles

      public Set<String> getFiles()
      Gets the set of all registered file names.
      Returns:
      a set of all the registered file names.
    • getColor

      public Color getColor(String name)
      Gets the color associated to the given name.
      Parameters:
      name - name of the color
      Returns:
      the Color associated to the given name.
    • getColorInfo

      public ColorInfo getColorInfo(String name)
      Gets the color info object associated to the given name
      Parameters:
      name - name of the color
      Returns:
      the Color associated to the given name.
    • getColor

      public Color getColor(String name, Color def)
      Gets the color associated to the given name. The default color is returned if the color is undefined (null).
      Parameters:
      name - name of the color
      def - default value if the color is not defined
      Returns:
      the Color associated to the given name. If the color is null, the default color 'def' is returned.
    • setColor

      public void setColor(String name, Color color)
      Associates the given Color to the specified name.
      Parameters:
      name - name of the color
      color - color
    • setColor

      public void setColor(String name, ColorInfo color)
      Associates the given Color to the specified name.
      Parameters:
      name - name of the color
      color - color info object
    • getColors

      public Set<String> getColors()
      Gets the set of all registered color names.
      Returns:
      a set of all the registered color names.
    • getInput

      public Object getInput(String name)
      Gets the input associated to the given name.
      Parameters:
      name - name of the input key
      Returns:
      the input key associated to the given name.
    • getInput

      public Object getInput(String name, Object def)
      Gets the input key associated to the given name. The 'def' value is returned if there is no input associated with the given name.
      Parameters:
      name - name of the input
      def - default to return if the input is undefined
      Returns:
      the input key associated to the given name.
    • setInput

      public void setInput(String name, Object input)
      Associates the given input key to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the input
      input - input key
    • getInputs

      public Set<String> getInputs()
      Gets the set of all registered input names.
      Returns:
      a set of all the registered input names.
    • getMAMethod

      public Enums.MAMethod getMAMethod(String name)
      Gets the Moving Average Calculation method associated to the given name
      Parameters:
      name - name of the method
      Returns:
      the MAMethod associated to the given name.
    • getMAMethod

      public Enums.MAMethod getMAMethod(String name, Enums.MAMethod def)
      Gets the Moving Average Calculation method associated to the given name. The given default value is returned if the method is not defined.
      Parameters:
      name - name of the method
      def - default value to return if the method is not defined
      Returns:
      the MAMethod associated to the given name.
    • setMAMethod

      public void setMAMethod(String name, Enums.MAMethod method)
      Associates the given MAMethod to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the method
      method - moving average method
    • getMAMethods

      public Set<String> getMAMethods()
      Gets the set of all registered Moving Average Method names.
      Returns:
      a set of all the registered MAMethod names.
    • getBarSize

      public BarSize getBarSize(String name)
      Gets the bar size associated to the given name.
      Parameters:
      name - name of the bar size
      Returns:
      the BarSize associated to the given name.
    • setBarSize

      public void setBarSize(String name, BarSize barSize)
      Associates the given BarSize to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the bar size
      barSize - bar size
    • getBarSizes

      public Set<String> getBarSizes()
      Gets the set of all registered bar size names.
      Returns:
      a set of all the registered BarSize names.
    • getInstrument

      public Instrument getInstrument(String name)
      Gets the instrument associated to the given name
      Parameters:
      name - name of the instrument
      Returns:
      the Instrument associated to the given name.
    • setInstrument

      public void setInstrument(String name, Instrument instrument)
      Associates the given Instrument to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the instrument
      instrument - instrument to associate
    • getInstruments

      public Set<String> getInstruments()
      Gets the set of all registered instrument names.
      Returns:
      a set of all the registered Instrument names.
    • hasInstruments

      public boolean hasInstruments()
      Returns:
      true if instruments are defined
    • getExitPoint

      public ExitPoint getExitPoint(String name)
      Gets the exit point associated to the given name.
      Parameters:
      name - name of the exit point
      Returns:
      the ExitPoint associated to the given name.
    • setExitPoint

      public void setExitPoint(String name, ExitPoint ep)
      Associates the given ExitPoint to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the exit point
      ep - exit point
    • getExitPoints

      public Set<String> getExitPoints()
      Gets the set of all registered Exit Point names.
      Returns:
      a set of all the registered ExitPoint names.
    • getTimeFrame

      public TimeFrame getTimeFrame(String name)
      Gets the timeframe associated to the given name.
      Parameters:
      name - name of the timeframe
      Returns:
      the TimeFrame associated to the given name.
    • setTimeFrame

      public void setTimeFrame(String name, TimeFrame tf)
      Associates the given TimeFrame to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the timeframe
      tf - time frame to associate to the given name
    • getTimeFrames

      public Set<String> getTimeFrames()
      Gets the set of all registered time frame names.
      Returns:
      a set of all the registered TimeFrame names.
    • getOrderType

      public Enums.OrderType getOrderType(String name)
      Gets the order type associated to the given name.
      Parameters:
      name - name of the order type
      Returns:
      the OrderType associated to the given name.
    • setOrderType

      public void setOrderType(String name, Enums.OrderType type)
      Associates the given OrderType to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the order type
      type - order type
    • getTIF

      public Enums.TIF getTIF(String name)
      Gets the tif (Time In Force) value associated to the given name.
      Parameters:
      name - name of the tif
      Returns:
      time in force associated to the given name
    • setTIF

      public void setTIF(String name, Enums.TIF tif)
      Associates the given TIF (time in force) to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the tif
      tif - time in force
    • getValues

      public Set<String> getValues()
      Gets the set of value keys in the settings.
      Returns:
      set of value keys in the settings
    • getValue

      public Object getValue(String name)
      Gets the set of value associated with the given key.
      Parameters:
      name - name of the value
      Returns:
      value associated to the given name
    • setValue

      public void setValue(String name, Object val)
    • getDouble

      public Double getDouble(String name)
      Gets the double value associated to the given name.
      Parameters:
      name - name of the double value
      Returns:
      double value associated to the given name
    • getDouble

      public double getDouble(String name, double def)
      Gets the double value associated to the given name. The def value is returned if the setting does not exist.
      Parameters:
      name - name of the double value
      def - default value to return if not defined
      Returns:
      double value associated to the given name.
    • setDouble

      public void setDouble(String name, Double val)
      Associates the given double value to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the double value
      val - double value
    • getInteger

      public Integer getInteger(String name)
      Gets the integer value associated to the given name.
      Parameters:
      name - name of the value
      Returns:
      integer value associated to the given name
    • getInteger

      public int getInteger(String name, int def)
      Gets the integer value associated to the given name. The def value is returned if the setting does not exist.
      Parameters:
      name - name of the integer value
      def - default value to return if the name does not exist
      Returns:
      integer value
    • setInteger

      public void setInteger(String name, Integer val)
      Associates the given integer value to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the value
      val - value to associate
    • getLong

      public Long getLong(String name)
      Gets the long value associated to the given name.
      Parameters:
      name - name of the value
      Returns:
      long value associated to the given name
    • setLong

      public void setLong(String name, Long val)
      Associates the given integer value to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the value
      val - value to associate
    • getBoolean

      public Boolean getBoolean(String name)
      Gets the boolean value associated to the given name.
      Parameters:
      name - name of the value
      Returns:
      associated boolean value
    • getBoolean

      public boolean getBoolean(String name, boolean def)
      Gets the boolean value associated to the given name. The def value is returned if the setting does not exist.
      Parameters:
      name - name of the boolean value
      def - default value to return if the name does not exist
      Returns:
      boolean value
    • setBoolean

      public void setBoolean(String name, Boolean val)
      Associates the given boolean value to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the value
      val - value to associate
    • getString

      public String getString(String name)
      Gets the string value associated to the given name.
      Parameters:
      name - name of the value
      Returns:
      String value associated to the given name
    • getString

      public String getString(String name, String def)
      Gets the string value associated to the given name. The 'def' value is returned if the value is not defined
      Parameters:
      name - name of the string value
      def - default value to return if the string does not exist
      Returns:
      string value
    • setString

      public void setString(String name, String val)
      Associates the given string value to the specified name. This is called by the underlying study framework.
      Parameters:
      name - name of the value
      val - string value to associate
    • getSetting

      public Object getSetting(String name)
      Gets the setting associated to the given name.
      Parameters:
      name - name of the setting
      Returns:
      the setting associated with the specified name.
    • update

      public void update(Settings settings)
      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

      public Enums.PositionType getPositionType()
      Indicates position type to be used with the strategy (long, short or both).
      Returns:
      position type
    • setPositionType

      public void setPositionType(Enums.PositionType p)
      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

      public void setTimeInForce(Enums.TIF tif)
      Sets the time in force (TIF) for orders (strategies only).
      Parameters:
      tif - time in force
    • getTimeInForce

      public Enums.TIF 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

      public List<TimeFrame> getSessions()
      Gets the trading sessions (strategies only).
      Returns:
      trading sessions
    • addSession

      public void addSession(TimeFrame session)
      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

      public TimeZone getTimeZone()
      Gets the timezone for sessions (null for local time zone).
      Returns:
      timezone for sessions
    • setTimeZone

      public void setTimeZone(TimeZone tz)
      Sets the timezone for sessions (null for local time zone).
      Parameters:
      tz - time zone
    • getTbEditorNames

      public List<String> getTbEditorNames()
    • setTbEditorNames

      public void setTbEditorNames(List<String> ids)
    • clone

      public Settings clone()
      Creates a clone (copy) of this object.
      Overrides:
      clone in class Object
      Returns:
      clone of this object
    • equals

      public boolean equals(Object o)
      Compares this settings object with the given object and returns true if they are equal.
      Overrides:
      equals in class Object
      Parameters:
      o - object to compare to
      Returns:
      true if this object equals the given object
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Adds a property change listener.
      Parameters:
      listener - property change listener
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Removes a property change listener.
      Parameters:
      listener - property change listener
    • removeAllPropertyChangeListeners

      public void removeAllPropertyChangeListeners()
      Removes all property change listeners.