This method calculates and returns position quantity for a given symbol and position type.
var getPositionQuantity(symbol, positionType);
symbol
String value representing a symbol for which to calculate the quantity.
positionType
One of the position types.
If the method successfully finds the data for a given symbol and position type, it calculates position's quantity and returns a floating value. If no data is found, the method returns 0.
This method is typically used to quickly figure out the quantity for a given symbol.
The following example demonstrates the use of getPositionQuantity() method.
function start()
{
//if there is an open position for current symbol, do not process anything
//get the symbol that's attached to current trading system
var symbol;
if(getSymbol(symbol) == true)
{
var account = getAccount();
if(account.getPositionQuantity(symbol, POSITIONTYPE_LONG) > 0.00)
return;
}
//continue processing...
}
Copyright © 2006-2009 ActiveTick LLC