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
FieldsModifier and TypeFieldDescriptionstatic org.slf4j.LoggerThe Constant Log.The Strategy. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone(boolean includingParameters, StrategyBase strategy)Clone.abstract doublecomputeValue(byte orderType, StrategyBase strategy, String symbol, double price)Compute value.voidcopyCustomData(IBlock block)Copy custom data.doublecorrectSLPT(double openPrice, double SLPT, int direction, double tickSize, boolean isSL)Correct SLPT.doublecorrectSLPT(ILiveOrder order, double SLPT, boolean isSL)Correct SLPT.voidcreateExitMethodXml(org.jdom2.Element elExitRules)Creates the exit method xml.doubleEvaluate block.doubleevaluateBlock(int relativeShift)Evaluate block.voidgenerateXmlParams(org.jdom2.Element elParamCategory, Field exitMethodsField, org.jdom2.Element elBlock, ExitMethod[] exitMethods, boolean realData)Generate xml params.org.jdom2.ElementgetCustomBlockXml(int type)Gets the custom block xml.intgetCustomData(String key)Gets the custom data.intGets the exit type.intGets 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.voidsetCustomData(String key, int value)Sets the custom data.booleansetExit(ILiveOrder order, StrategyBase strategy)Sets the exit.abstract voidsetForOrder(ILiveOrder order, StrategyBase strategy)Sets the for order.voidsetReturnType(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:
evaluateBlockin interfaceIBlock- Returns:
- the double
- Throws:
TradingException- the trading exception
-
evaluateBlock
Evaluate block.- Specified by:
evaluateBlockin 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:
newInstancein interfaceIBlock- Parameters:
strategy- the strategyelBlock- the el block- Returns:
- the i block
- Throws:
BlockDefinitionException- the block definition exception
-
getStrategy
Gets the strategy.- Specified by:
getStrategyin interfaceIBlock- Returns:
- the strategy
-
clone
public IBlock clone(boolean includingParameters, StrategyBase strategy) throws BlockDefinitionExceptionClone.- Specified by:
clonein 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:
setCustomDatain interfaceIBlock- Parameters:
key- the keyvalue- the value
-
getCustomData
Gets the custom data.- Specified by:
getCustomDatain interfaceIBlock- Parameters:
key- the key- Returns:
- the custom data
-
copyCustomData
Copy custom data.- Specified by:
copyCustomDatain 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:
getReturnTypein interfaceIBlock- Returns:
- the return type
-
setReturnType
public void setReturnType(int returnType)Sets the return type.- Specified by:
setReturnTypein 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:
getCustomBlockXmlin interfaceIBlock- Parameters:
type- the type- Returns:
- the custom block xml
- Throws:
BlockDefinitionException- the block definition exception
-