ICE Data Services -

Strategy.getDefaultLotSize() Back Testing Functions

getDefaultLotSize() is a method of the Strategy Object that retrieves the "Default Lot Size" parameter specified in the Back Testing window when setting up a back testing analysis through the Strategy Analyzer (Tools-->Back Testing).  The Strategy Object is for back testing purposes only and is not intended for real time trading.



Strategy .getDefaultLotSize( )



Return Value(s)




getDefaultLotSize() returns the number specified in the "Default Lot Size" input box under the Back Testing Preferences section of the Back Testing window.  This method is typically used with strategies that perform laddering for the entry logic and or exiting portions of a position.


Code Examples

// Retrieve the current size of a position. var nDefaultLot = Strategy.getDefaultLotSize();
// Assign the number of shares/contracts of an existing position to a variable that
// will be used to close half of the position.  When specifying a lot size 
// in the doSell() or doCover() methods, ensure that the number for the lot 
// size specified is a whole number by rounding the result like

below.var nHalf = Math.round(Strategy.getDefaultLotSize() / 2);
var nStop = hl2();
Strategy.doSell("Exit Long Signal", Strategy.STOP, Strategy.THISBAR, nHalf, nStop);


See Also

Back Testing Functions
EFS Library:  Back Testing
Strategy Analyzer
eSignal Bulletin Board Search Engine
Help Guides and Tutorials