AtmStrategyCancelEntryOrder()

View as Markdown

Definition

Cancels the specified entry order determined by the string “orderId” parameter.

  1. This method is intended ONLY for orders submitted as Atm Entry Orders and assumes the OrderState is NOT terminal (i.e., Cancelled, Filled, Rejected, Unknown).
  2. If the specified order does not exist, the method returns false and an error is logged.

Method Return Value

Returns true if the specified order was found; otherwise false.

Syntax

AtmStrategyCancelEntryOrder(string orderId)

This method should ONLY be called once the strategy State has reached State.Realtime

Parameters

orderId
The unique identifier for the entry order

Examples

1protected override void OnBarUpdate()
2{
3 // ATM strategy methods only work during real-time
4 if (State != State.Realtime)
5 return;
6
7 string[] entryOrder = GetAtmStrategyEntryOrderStatus("orderId");
8
9 // checks if the entry order exists
10 // and the order state is not already cancelled/filled/rejected
11 if (entryOrder.Length > 0 && entryOrder[2] == "Working")
12 {
13 AtmStrategyCancelEntryOrder("orderId");
14 }
15}