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
Modifier and TypeFieldDescriptionstatic double
The Constant defaultInitialCapital.The name.Fields inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItem
_text, editable
Fields 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
-
Method Summary
Modifier and TypeMethodDescriptiondouble
computeTradeSize(StrategyBase strategy, String symbol, byte orderType, double price, double sl, double tickSize, double pointValue, double sizeStep)
Compute trade size.double
computeTradeSize(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.double
Gets the initial capital.org.jdom2.Element
getXML()
Gets the xml.New instance.double
round(double value, double step, int decimals)
Rounds the number.void
setFromParameterEl(org.jdom2.Element paramElem)
Sets the from parameter el.void
setFromXML(org.jdom2.Element mmElem)
Sets the from XML.void
setInitialCapital(double initialCapital)
Sets the initial capital.void
setMethodFromXML(org.jdom2.Element elMethod)
Sets the method from XML.void
Sets the name.Methods inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItem
equals, getDescription, getEngine, getFormatedName, getName, getNote, isEditable, isUsed, newInstance, printFormatedName, setEditable, setUsed
Methods inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItemProperties
getParametersList, getParameterValue, getParams, getPGParameterValue, setDefaultValues, setParameterValue, setParams
Methods 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:
getXML
in interfacecom.strategyquant.lib.settings.IXMLAble
- Overrides:
getXML
in classcom.strategyquant.tradinglib.propertygrid.ParametersTableItem
- Returns:
- the xml
-
setFromXML
Sets the from XML.- Specified by:
setFromXML
in interfacecom.strategyquant.lib.settings.IXMLAble
- Overrides:
setFromXML
in 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:
setFromParameterEl
in classcom.strategyquant.tradinglib.propertygrid.ParametersTableItem
- Parameters:
paramElem
- the new from parameter el- Throws:
Exception
- the exception
-
getClone
Gets the clone.- Specified by:
getClone
in interfacecom.strategyquant.lib.utils.ISQCloneable<MoneyManagementMethod>
- Overrides:
getClone
in 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
-