CancelAllOrders()

View as Markdown

Definition

Cancels all orders for the specified instrument on the connection.

Syntax

\<connection\>.CancelAllOrders(Instrument instrument)

NameDescription
instrumentAn Instrument object used to identify the instrument for which to cancel orders

Examples

1private Account myAccount;
2
3protected override void OnStateChange()
4{
5 if (State == State.SetDefaults)
6 {
7 // Initialize myAccount
8 }
9}
10
11private void OnExecutionUpdate(object sender, ExecutionEventArgs e)
12{
13 // Cancel all orders if an execution is triggered after 9pm
14 if (e.Time > new DateTime(now.Year, now.Month, now.Day, 21, 0, 0))
15 myAccount.CancelAllOrders(e.Execution.Instrument);
16}