Class ChartSetup

java.lang.Object
com.strategyquant.tradinglib.ChartSetup
All Implemented Interfaces:
com.strategyquant.lib.settings.IXMLAble, com.strategyquant.lib.utils.ISQCloneable<ChartSetup>, Serializable

public class ChartSetup extends Object implements com.strategyquant.lib.settings.IXMLAble, Serializable, com.strategyquant.lib.utils.ISQCloneable<ChartSetup>
The Class ChartSetup.
See Also:
Serialized Form
  • Constructor Details

    • ChartSetup

      public ChartSetup()
      Used when creating chartSetup from XML.
    • ChartSetup

      public ChartSetup(String connectionName, String symbol, String timeframe, int backloadType, long backloadNumber, String session) throws com.strategyquant.datalib.data.DataException
      constructor called for live trading
      Parameters:
      connectionName - the connection name
      symbol - the symbol
      timeframe - the timeframe
      backloadType - the backload type
      backloadNumber - the backload number
      session - the session
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
    • ChartSetup

      public ChartSetup(String connectionName, String symbol, String timeframe, long dateFrom, long dateTo, double symbolSpread, String session) throws com.strategyquant.datalib.data.DataException
      constructor called for backtesting
      Parameters:
      connectionName - the connection name
      symbol - the symbol
      timeframe - the timeframe
      dateFrom - the date from
      dateTo - the date to
      symbolSpread - the symbol spread
      session - the session
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
    • ChartSetup

      public ChartSetup(String symbol, String timeframe, long dateFrom, long dateTo, double symbolSpread, String session) throws com.strategyquant.datalib.data.DataException
      constructor called for backtesting. If no connectionName is given then "History" is used by default
      Parameters:
      symbol - the symbol
      timeframe - the timeframe
      dateFrom - the date from
      dateTo - the date to
      symbolSpread - the symbol spread
      session - the session
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
  • Method Details

    • addChart

      public ChartDef addChart(String connectionName, String symbol, String timeframe, double symbolSpread) throws com.strategyquant.datalib.data.DataException
      Adds the chart.
      Parameters:
      connectionName - the connection name
      symbol - the symbol
      timeframe - the timeframe
      symbolSpread - the symbol spread
      Returns:
      the chart def
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
    • addChart

      public ChartDef addChart(String connectionName, String symbol, String timeframe) throws com.strategyquant.datalib.data.DataException
      Adds the chart.
      Parameters:
      connectionName - the connection name
      symbol - the symbol
      timeframe - the timeframe
      Returns:
      the chart def
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
    • registerConnectionSymbols

      public void registerConnectionSymbols(com.strategyquant.tradinglib.connection.ConnectionManager connectionManager) throws Exception
      Register connection symbols.
      Parameters:
      connectionManager - the connection manager
      Throws:
      Exception - the exception
    • checkConnectionSymbolExist

      public void checkConnectionSymbolExist(com.strategyquant.tradinglib.connection.ConnectionManager connectionManager) throws com.strategyquant.datalib.data.DataException
      method checks if given connections and symbols exists or if symbols are supported by the connection.
      Parameters:
      connectionManager - the connection manager
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
    • getCharts

      public ArrayList<ChartDef> getCharts()
      returns list of charts that are in this chart setup.
      Returns:
      the charts
    • runChecks

      public void runChecks(com.strategyquant.tradinglib.connection.ConnectionManager connectionManager) throws Exception
      Run checks.
      Parameters:
      connectionManager - the connection manager
      Throws:
      Exception - the exception
    • getChartsCount

      public int getChartsCount()
      Gets the charts count.
      Returns:
      the charts count
    • getClone

      public ChartSetup getClone()
      Gets the clone.
      Specified by:
      getClone in interface com.strategyquant.lib.utils.ISQCloneable<ChartSetup>
      Returns:
      the clone
    • getClone

      public ChartSetup getClone(long from, long to)
      Gets the clone.
      Parameters:
      from - the from
      to - the to
      Returns:
      the clone
    • getClone

      public ChartSetup getClone(String symbol)
      Gets the clone with changed symbol - used to create temporary groups for Single-Asset backtests..
      Parameters:
      symbol -
      Returns:
      the clone
    • isUsed

      public boolean isUsed()
      Checks if is used.
      Returns:
      true, if is used
    • setUsed

      public void setUsed()
      Sets the used.
    • isCreatedUsingBackload

      public boolean isCreatedUsingBackload()
      Checks if is created using backload.
      Returns:
      true, if is created using backload
    • getMainChart

      public ChartDef getMainChart()
      returns main chart of this chart setup.
      Returns:
      the main chart
    • getXML

      public org.jdom2.Element getXML()
      Gets the xml.
      Specified by:
      getXML in interface com.strategyquant.lib.settings.IXMLAble
      Returns:
      the xml
    • setFromXML

      public void setFromXML(org.jdom2.Element element)
      Sets the from XML.
      Specified by:
      setFromXML in interface com.strategyquant.lib.settings.IXMLAble
      Parameters:
      element - the new from XML
    • setMinDistance

      public void setMinDistance(double minDistance)
      Sets the min distance.
      Parameters:
      minDistance - the new min distance
    • setTestPrecision

      public void setTestPrecision(int testPrecision)
      Sets the test precision.
      Parameters:
      testPrecision - the new test precision
    • getTestPrecision

      public int getTestPrecision()
      Gets the test precision.
      Returns:
      the test precision
    • addAllCharts

      public void addAllCharts(ChartSetup chartSetup)
      Adds the all charts.
      Parameters:
      chartSetup - the chart setup
    • addChart

      public void addChart(ChartDef chartDef)
      Adds the chart.
      Parameters:
      chartDef - the chart def
    • getCommissionsMethod

      public CommissionsMethod getCommissionsMethod()
      Gets the commissions method.
      Returns:
      the commissions method
    • setCommissionsMethod

      public void setCommissionsMethod(CommissionsMethod commissionsMethod)
      Sets the commissions method.
      Parameters:
      commissionsMethod - the new commissions method
    • getBacktestEngine

      public int getBacktestEngine()
      Gets the backtest engine.
      Returns:
      the backtest engine
    • setBacktestEngine

      public void setBacktestEngine(int backtestEngine)
      Sets the backtest engine.
      Parameters:
      backtestEngine - the new backtest engine
    • getTFsAsString

      public String getTFsAsString()
      Gets the t fs as string.
      Returns:
      the t fs as string
    • getSymbol

      public String getSymbol()
      Gets the symbol.
      Returns:
      the symbol
    • getTimeframe

      public String getTimeframe()
      Gets the timeframe.
      Returns:
      the timeframe
    • createFirstAvailableData

      public static ChartSetup createFirstAvailableData() throws Exception
      Creates the first available data.
      Returns:
      the chart setup
      Throws:
      Exception - the exception
    • applyChanges

      public void applyChanges(ChartSetup oldSetup, HashMap<String,​Object> settingsMap) throws com.strategyquant.datalib.data.DataException, ParseException
      Throws:
      com.strategyquant.datalib.data.DataException
      ParseException