Package com.strategyquant.tradinglib
Class MoneyManagementMethod
java.lang.Object
com.strategyquant.tradinglib.debug.Debugger
com.strategyquant.tradinglib.propertygrid.ParametersTableItemProperties
com.strategyquant.tradinglib.propertygrid.ParametersTableItem
com.strategyquant.tradinglib.MoneyManagementMethod
- All Implemented Interfaces:
com.strategyquant.lib.settings.IXMLAble,com.strategyquant.lib.utils.ISQCloneable<MoneyManagementMethod>,Serializable
public abstract class MoneyManagementMethod
extends com.strategyquant.tradinglib.propertygrid.ParametersTableItem
implements com.strategyquant.lib.utils.ISQCloneable<MoneyManagementMethod>
The Class MoneyManagementMethod.
- See Also:
- Serialized Form
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic doubleThe Constant defaultInitialCapital.The name.Fields inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItem
_text, editableFields inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItemProperties
df, Log, TYPE_BOOLEAN, TYPE_DATE, TYPE_DOUBLE, TYPE_INT, TYPE_INT_LIST, TYPE_STR_LIST, TYPE_STRING, TYPE_TIME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublecomputeTradeSize(StrategyBase strategy, String symbol, byte orderType, double price, double sl, double tickSize, double pointValue, double sizeStep)Compute trade size.doublecomputeTradeSize(StrategyBase strategy, String symbol, byte orderType, double price, double sl, double tickSize, double pointValue, double sizeStep, double maxPos)Compute trade size.getClone()Gets the clone.doubleGets the initial capital.org.jdom2.ElementgetXML()Gets the xml.New instance.doubleround(double value, double step, int decimals)Rounds the number.voidsetFromParameterEl(org.jdom2.Element paramElem)Sets the from parameter el.voidsetFromXML(org.jdom2.Element mmElem)Sets the from XML.voidsetInitialCapital(double initialCapital)Sets the initial capital.voidsetMethodFromXML(org.jdom2.Element elMethod)Sets the method from XML.voidSets the name.Methods inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItem
equals, getDescription, getEngine, getFormatedName, getName, getNote, isEditable, isUsed, newInstance, printFormatedName, setEditable, setUsedMethods inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItemProperties
getParametersList, getParameterValue, getParams, getPGParameterValue, setDefaultValues, setParameterValue, setParamsMethods inherited from class com.strategyquant.tradinglib.debug.Debugger
debug, fdebug
-
Field Details
-
name
The name. -
defaultInitialCapital
public static final double defaultInitialCapitalThe Constant defaultInitialCapital.- See Also:
- Constant Field Values
-
-
Constructor Details
-
MoneyManagementMethod
public MoneyManagementMethod()
-
-
Method Details
-
setName
Sets the name.- Parameters:
name- the new name
-
getInitialCapital
public double getInitialCapital()Gets the initial capital.- Returns:
- the initialCapital
-
setInitialCapital
public void setInitialCapital(double initialCapital)Sets the initial capital.- Parameters:
initialCapital- the initialCapital to set
-
getXML
public org.jdom2.Element getXML()Gets the xml.- Specified by:
getXMLin interfacecom.strategyquant.lib.settings.IXMLAble- Overrides:
getXMLin classcom.strategyquant.tradinglib.propertygrid.ParametersTableItem- Returns:
- the xml
-
setFromXML
Sets the from XML.- Specified by:
setFromXMLin interfacecom.strategyquant.lib.settings.IXMLAble- Overrides:
setFromXMLin classcom.strategyquant.tradinglib.propertygrid.ParametersTableItem- Parameters:
mmElem- the new from XML- Throws:
Exception- the exception
-
newInstance
New instance.- Returns:
- the money management method
- Throws:
Exception- the exception
-
computeTradeSize
public double computeTradeSize(StrategyBase strategy, String symbol, byte orderType, double price, double sl, double tickSize, double pointValue, double sizeStep) throws ExceptionCompute trade size.- Parameters:
strategy- the strategysymbol- the symbolorderType- the order typeprice- the pricesl- the sltickSize- the tick sizepointValue- the point value- Returns:
- the double
- Throws:
Exception- the exception
-
computeTradeSize
public double computeTradeSize(StrategyBase strategy, String symbol, byte orderType, double price, double sl, double tickSize, double pointValue, double sizeStep, double maxPos) throws ExceptionCompute trade size.- Parameters:
strategy- the strategysymbol- the symbolorderType- the order typeprice- the pricesl- the sltickSize- the tick sizepointValue- the point valuemaxPos- the maximum number of simultaneously open trades- Returns:
- the double
- Throws:
Exception- the exception
-
setMethodFromXML
Sets the method from XML.- Parameters:
elMethod- the new method from XML- Throws:
Exception- the exception
-
setFromParameterEl
Sets the from parameter el.- Overrides:
setFromParameterElin classcom.strategyquant.tradinglib.propertygrid.ParametersTableItem- Parameters:
paramElem- the new from parameter el- Throws:
Exception- the exception
-
getClone
Gets the clone.- Specified by:
getClonein interfacecom.strategyquant.lib.utils.ISQCloneable<MoneyManagementMethod>- Overrides:
getClonein classcom.strategyquant.tradinglib.propertygrid.ParametersTableItem- Returns:
- the clone
- Throws:
Exception- the exception
-
round
public double round(double value, double step, int decimals)Rounds the number.- Parameters:
value- the valuestep- the stepdecimals- the decimals- Returns:
- the value
- Throws:
Exception- the exception
-