CreateOrder()

View as Markdown

Definition

Creates an Order to be submitted via Submit().

Syntax

CreateOrder(Instrument instrument, OrderAction action, OrderType orderType, OrderEntry orderEntry, TimeInForce timeInForce, int quantity, double limitPrice, double stopPrice, string oco, string name, DateTime gtd, CustomOrder customOrder)

Parameters

ParameterDescription
instrumentOrder instrument
orderActionPossible values:
OrderAction.Buy
OrderAction.BuyToCover
OrderAction.Sell
OrderAction.SellShort
orderTypePossible values:
OrderType.Limit
OrderType.Market
OrderType.MIT
OrderType.StopMarket
OrderType.StopLimit
orderEntryPossible values:
OrderEntry.Automated
OrderEntry.Manual
• Allows setting the tag for orders submitted manually or via automated trading logic (CME tag 1028).
timeInForcePossible values:
TimeInForce.Day
TimeInForce.Gtc
TimeInForce.Gtd
TimeInForce.Ioc
TimeInForce.Opg
quantityOrder quantity
limitPriceOrder limit price. Use “0” should this parameter be irrelevant for the OrderType being submitted.
stopPriceOrder stop price. Use “0” should this parameter be irrelevant for the OrderType being submitted.
ocoA string representing the OCO ID used to link OCO orders together
nameA string representing the name of the order. Max 50 characters.
• Note: If using ATM Strategy StartAtmStrategy(), this value MUST be “Entry”
gtdA DateTime value to be used with TimeInForce.Gtd - for all other cases you can pass in Core.Globals.MaxDate
customOrderCustom order if it is being used

Examples

1// Example code
2Order stopOrder;
3stopOrder = myAccount.CreateOrder(myInstrument, OrderAction.Sell, OrderType.StopMarket, OrderEntry.Automated, TimeInForce.Day, 1, 0, 1400, "myOCO", "stopOrder", Core.Globals.MaxDate, null);
4
5myAccount.Submit(new[] { stopOrder });