This callback function gets called whenever ActiveTick receives an execution from a trading broker for previously placed order.
onOrderExecution(execution);
execution
Instance of Execution object filled with details about the execution.
This callback is useful to receive status indications whenever the order has successfully been processed executed.
The following example demonstrates the use of onOrderExecution() callback function.
function start()
{
//retrieve short positions for all symbols
var account = getAccount();
var placeLongOrder = false;
//determine whether a long order needs to be placed
..
..
..
if(placeLongOrder)
{
var rc = account.placeMarketOrder(getSymbol(),
parseFloat(getParameter("Default Trading Size")),
ACTIONTYPE_BUY,
TIFTYPE_DAY);
}
}
function onOrderExecution(execution)
{
//process order results
if(getSymbol() != execution.getSymbol())
return;
Debug.writeLine("Execution for symbol " + execution.getSymbol() + " at price " + execution.getPrice());
}
placeOrderCancel(), getAccount(), getSymbol(), Account Class, Order Class, OrderResults Class, Execution Class
Copyright © 2006-2009 ActiveTick LLC