You are here: Trading System Programming > Reference > Callback Functions > Functions > onOrderExecution

onOrderExecution

This callback function gets called whenever ActiveTick receives an execution from a trading broker for previously placed order.

 

Syntax

onOrderExecution(execution);

Parameters

execution

Instance of Execution object filled with details about the execution.

 

Remarks

This callback is useful to receive status indications whenever the order has successfully been processed executed.

Example

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());

}

 

See Also

placeOrderCancel(), getAccount(), getSymbol(), Account Class, Order Class, OrderResults Class, Execution Class

 


Copyright © 2006-2009 ActiveTick LLC