Package com.strategyquant.tradinglib
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 Summary
Modifier and TypeFieldDescriptionstatic org.slf4j.Logger
The Constant Log.The Strategy. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone(boolean includingParameters, StrategyBase strategy)
Clone.abstract double
computeValue(byte orderType, StrategyBase strategy, String symbol, double price)
Compute value.void
copyCustomData(IBlock block)
Copy custom data.double
correctSLPT(double openPrice, double SLPT, int direction, double tickSize, boolean isSL)
Correct SLPT.double
correctSLPT(ILiveOrder order, double SLPT, boolean isSL)
Correct SLPT.void
createExitMethodXml(org.jdom2.Element elExitRules)
Creates the exit method xml.double
Evaluate block.double
evaluateBlock(int relativeShift)
Evaluate block.void
generateXmlParams(org.jdom2.Element elParamCategory, Field exitMethodsField, org.jdom2.Element elBlock, ExitMethod[] exitMethods, boolean realData)
Generate xml params.org.jdom2.Element
getCustomBlockXml(int type)
Gets the custom block xml.int
getCustomData(String key)
Gets the custom data.int
Gets the exit type.int
Gets the return type.Gets the strategy.newInstance(StrategyBase strategy, ArrayList<org.jdom2.Element> params)
New instance.newInstance(StrategyBase strategy, org.jdom2.Element elBlock)
New instance.void
setCustomData(String key, int value)
Sets the custom data.boolean
setExit(ILiveOrder order, StrategyBase strategy)
Sets the exit.abstract void
setForOrder(ILiveOrder order, StrategyBase strategy)
Sets the for order.void
setReturnType(int returnType)
Sets the return type.Methods inherited from class com.strategyquant.tradinglib.debug.Debugger
debug, fdebug
-
Field Details
-
Log
public static final org.slf4j.Logger LogThe Constant Log. -
Strategy
The Strategy.
-
-
Constructor Details
-
ExitMethod
public ExitMethod()
-
-
Method Details
-
computeValue
public abstract double computeValue(byte orderType, StrategyBase strategy, String symbol, double price) throws TradingExceptionCompute value.- Parameters:
orderType
- the order typestrategy
- the strategysymbol
- the symbolprice
- the price- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
setForOrder
Sets the for order.- Parameters:
order
- the orderstrategy
- the strategy- Throws:
TradingException
- the trading exception
-
newInstance
public ExitMethod newInstance(StrategyBase strategy, ArrayList<org.jdom2.Element> params) throws BlockDefinitionExceptionNew instance.- Parameters:
strategy
- the strategyparams
- 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 BlockDefinitionExceptionGenerate xml params.- Parameters:
elParamCategory
- the el param categoryexitMethodsField
- the exit methods fieldelBlock
- the el blockexitMethods
- the exit methodsrealData
- the real data- Throws:
BlockDefinitionException
- the block definition exception
-
createExitMethodXml
Creates the exit method xml.- Parameters:
elExitRules
- the el exit rules- Throws:
BlockDefinitionException
- the block definition exception
-
evaluateBlock
Evaluate block.- Specified by:
evaluateBlock
in interfaceIBlock
- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
evaluateBlock
Evaluate block.- Specified by:
evaluateBlock
in interfaceIBlock
- Parameters:
relativeShift
- the relative shift- Returns:
- the double
- Throws:
TradingException
- the trading exception
-
newInstance
public IBlock newInstance(StrategyBase strategy, org.jdom2.Element elBlock) throws BlockDefinitionExceptionNew instance.- Specified by:
newInstance
in interfaceIBlock
- Parameters:
strategy
- the strategyelBlock
- the el block- Returns:
- the i block
- Throws:
BlockDefinitionException
- the block definition exception
-
getStrategy
Gets the strategy.- Specified by:
getStrategy
in interfaceIBlock
- Returns:
- the strategy
-
clone
public IBlock clone(boolean includingParameters, StrategyBase strategy) throws BlockDefinitionExceptionClone.- Specified by:
clone
in interfaceIBlock
- Parameters:
includingParameters
- the including parametersstrategy
- the strategy- Returns:
- the i block
- Throws:
BlockDefinitionException
- the block definition exception
-
setCustomData
Sets the custom data.- Specified by:
setCustomData
in interfaceIBlock
- Parameters:
key
- the keyvalue
- the value
-
getCustomData
Gets the custom data.- Specified by:
getCustomData
in interfaceIBlock
- Parameters:
key
- the key- Returns:
- the custom data
-
copyCustomData
Copy custom data.- Specified by:
copyCustomData
in interfaceIBlock
- 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 interfaceIBlock
- Returns:
- the return type
-
setReturnType
public void setReturnType(int returnType)Sets the return type.- Specified by:
setReturnType
in interfaceIBlock
- Parameters:
returnType
- the new return type
-
correctSLPT
Correct SLPT.- Parameters:
order
- the orderSLPT
- the slptisSL
- 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 priceSLPT
- the slptdirection
- the directiontickSize
- the tick sizeisSL
- the is SL- Returns:
- the double
-
setExit
Sets the exit.- Parameters:
order
- the orderstrategy
- the strategy- Returns:
- true, if successful
- Throws:
TradingException
- the trading exception
-
getCustomBlockXml
Gets the custom block xml.- Specified by:
getCustomBlockXml
in interfaceIBlock
- Parameters:
type
- the type- Returns:
- the custom block xml
- Throws:
BlockDefinitionException
- the block definition exception
-