CancelAllOrders()

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Add On > Account >

CancelAllOrders()

Previous page Return to chapter overview Next page

Definition

Cancels all Orders of an instrument.

 

Syntax

CancelAllOrders(Instrument instrument)

 

Parameters

instrument

Instrument of the orders to be cancelled

 

 

Example

ns

private Account myAccount;
 
protected override void OnStateChange()
{
  if (State == State.SetDefaults)
  {
      // Initialize myAccount
  }

}

 

private void OnExecutionUpdate(object sender, ExecutionEventArgs e)
{
  // Cancel all orders if an execution is triggered after 9pm
  if (e.Time > new DateTime(now.Year, now.Month, now.Day, 21, 0, 0))
      myAccount.CancelAllOrders(e.Execution.Instrument);
}