Class ExitMethod

java.lang.Object
com.strategyquant.tradinglib.debug.Debugger
com.strategyquant.tradinglib.ExitMethod
All Implemented Interfaces:
IBlock

public abstract class ExitMethod extends com.strategyquant.tradinglib.debug.Debugger implements IBlock
The Class ExitMethod.
  • Field Details

    • Log

      public static final org.slf4j.Logger Log
      The Constant Log.
    • Strategy

      public StrategyBase Strategy
      The Strategy.
  • Constructor Details

    • ExitMethod

      public ExitMethod()
  • Method Details

    • computeValue

      public abstract double computeValue(byte orderType, StrategyBase strategy, String symbol, double price) throws TradingException
      Compute value.
      Parameters:
      orderType - the order type
      strategy - the strategy
      symbol - the symbol
      price - the price
      Returns:
      the double
      Throws:
      TradingException - the trading exception
    • setForOrder

      public abstract void setForOrder(ILiveOrder order, StrategyBase strategy) throws TradingException
      Sets the for order.
      Parameters:
      order - the order
      strategy - the strategy
      Throws:
      TradingException - the trading exception
    • newInstance

      public ExitMethod newInstance(StrategyBase strategy, ArrayList<org.jdom2.Element> params) throws BlockDefinitionException
      New instance.
      Parameters:
      strategy - the strategy
      params - the params
      Returns:
      the exit method
      Throws:
      BlockDefinitionException - the block definition exception
    • generateXmlParams

      public void generateXmlParams(org.jdom2.Element elParamCategory, Field exitMethodsField, org.jdom2.Element elBlock, ExitMethod[] exitMethods, boolean realData) throws BlockDefinitionException
      Generate xml params.
      Parameters:
      elParamCategory - the el param category
      exitMethodsField - the exit methods field
      elBlock - the el block
      exitMethods - the exit methods
      realData - the real data
      Throws:
      BlockDefinitionException - the block definition exception
    • createExitMethodXml

      public void createExitMethodXml(org.jdom2.Element elExitRules) throws BlockDefinitionException
      Creates the exit method xml.
      Parameters:
      elExitRules - the el exit rules
      Throws:
      BlockDefinitionException - the block definition exception
    • evaluateBlock

      public double evaluateBlock() throws TradingException
      Evaluate block.
      Specified by:
      evaluateBlock in interface IBlock
      Returns:
      the double
      Throws:
      TradingException - the trading exception
    • evaluateBlock

      public double evaluateBlock(int relativeShift) throws TradingException
      Evaluate block.
      Specified by:
      evaluateBlock in interface IBlock
      Parameters:
      relativeShift - the relative shift
      Returns:
      the double
      Throws:
      TradingException - the trading exception
    • newInstance

      public IBlock newInstance(StrategyBase strategy, org.jdom2.Element elBlock) throws BlockDefinitionException
      New instance.
      Specified by:
      newInstance in interface IBlock
      Parameters:
      strategy - the strategy
      elBlock - the el block
      Returns:
      the i block
      Throws:
      BlockDefinitionException - the block definition exception
    • getStrategy

      public StrategyBase getStrategy()
      Gets the strategy.
      Specified by:
      getStrategy in interface IBlock
      Returns:
      the strategy
    • clone

      public IBlock clone(boolean includingParameters, StrategyBase strategy) throws BlockDefinitionException
      Clone.
      Specified by:
      clone in interface IBlock
      Parameters:
      includingParameters - the including parameters
      strategy - the strategy
      Returns:
      the i block
      Throws:
      BlockDefinitionException - the block definition exception
    • setCustomData

      public void setCustomData(String key, int value)
      Sets the custom data.
      Specified by:
      setCustomData in interface IBlock
      Parameters:
      key - the key
      value - the value
    • getCustomData

      public int getCustomData(String key)
      Gets the custom data.
      Specified by:
      getCustomData in interface IBlock
      Parameters:
      key - the key
      Returns:
      the custom data
    • copyCustomData

      public void copyCustomData(IBlock block)
      Copy custom data.
      Specified by:
      copyCustomData in interface IBlock
      Parameters:
      block - the block
    • getExitType

      public int getExitType()
      Gets the exit type.
      Returns:
      the exit type
    • getReturnType

      public int getReturnType()
      Gets the return type.
      Specified by:
      getReturnType in interface IBlock
      Returns:
      the return type
    • setReturnType

      public void setReturnType(int returnType)
      Sets the return type.
      Specified by:
      setReturnType in interface IBlock
      Parameters:
      returnType - the new return type
    • correctSLPT

      public double correctSLPT(ILiveOrder order, double SLPT, boolean isSL)
      Correct SLPT.
      Parameters:
      order - the order
      SLPT - the slpt
      isSL - the is SL
      Returns:
      the double
    • correctSLPT

      public double correctSLPT(double openPrice, double SLPT, int direction, double tickSize, boolean isSL)
      Correct SLPT.
      Parameters:
      openPrice - the open price
      SLPT - the slpt
      direction - the direction
      tickSize - the tick size
      isSL - the is SL
      Returns:
      the double
    • setExit

      public boolean setExit(ILiveOrder order, StrategyBase strategy) throws TradingException
      Sets the exit.
      Parameters:
      order - the order
      strategy - the strategy
      Returns:
      true, if successful
      Throws:
      TradingException - the trading exception
    • getCustomBlockXml

      public org.jdom2.Element getCustomBlockXml(int type) throws BlockDefinitionException
      Gets the custom block xml.
      Specified by:
      getCustomBlockXml in interface IBlock
      Parameters:
      type - the type
      Returns:
      the custom block xml
      Throws:
      BlockDefinitionException - the block definition exception