A single Activation on Market Mode order can be submitted using the SubmitNewOrder method on the AccountList object:
' Submit an order.
moOrder = moAccounts.SubmitNewOrder( _
oAccount, _
oMarket, _
BuySell.Buy, _
PriceType.StopMarket, _
TimeType.Normal, _
1, _
0, _
CDbl(6534), _
OpenClose.Undefined, _
"", _
0, _
ActivationType.OnMarketMode, _
MarketMode.PreOpen)
The parameters for the SubmitNewOrder method are described
here.
| penPriceType | Set to PriceType.StopMarket for a stop market order. |
| penTimeType | Set to TimeType.Normal for a day order that will exist for the current trading day only. |
| piVolume | Set to the order volume you want. |
| pdblLimitPrice | Limit price is not needed for a stop market order so set this to 0. |
| pdblStopPrice | Set to the stop trigger price you want. Be sure that you are using the correct overloaded SubmitNewOrder method and providing either a display price as a double or a tick price as an integer. |
| penOpenClose | Set to OpenClose.Undefined. |
| psTag | Free text field for developer use. |
| piTrailTicks | Set to 0 to disable trailing. |
| penActivationType | Set to ActivationType.OnMarketMode to activate the order when the specified market mode becomes active. |
| psActivationValue | This string contains the details for when to activate the order. |
In this example, the order will be held on our servers until the Market mode is PreOpen. At that time it will submit the order to the exchange.
The format of the ActivationValue is "mode;cancel time"
| mode | Required. The market mode to activate the order on. |
| cancel time | Optional. The time to cancel the order if the order is still working or not yet activated. The time can be specified as either a full date time in the format "dd MMM yyyy HH:mm:ss" or as a number of seconds from now. |
Examples for psActivationValue:
- "Open" - activates when the market opens.
- "PreOpen" - activates when the market goes pre-open.
- "Open;05 Jul 2012 18:00:00" - activates the order when the market opens. The order is cancelled at the specified time (all times are U.S. Central Time) if it has not triggered yet and also if it has triggered but is still working. Using the datetime format of "dd MMM yyyy HH:mm:ss" is highly recommended.
- "Open;100" - activates the order when the market opens. The second paramter specifies the cancel time but as a number of seconds from the current time. In this case it is 100 seconds from now. At that time the order will be cancelled if it is working or not yet triggered.