public method TradeDeskAut.CreateEntryOrder4, CreateEntryOrder4Async

Brief

Creates an entry order and, if requested, a stop or limit or both orders (simple or pegged) on the entry order. Allows making any of the orders trailing and also allows choosing Time In Force for the entry order.

Partial functionality for United States based accounts. Specifying any values for Stop and Limit (besides 0) in this function will result in this function throwing an Exception/Error. Please read NFA Compliance Rule 2-43(b).

Declaration
Visual Basic
Sub CreateEntryOrder4 (wcsAccountID as String, wcsInstr as String, bIsBuy as Boolean, iAmount as Integer, dRate as Double, iTrailMinMove as Integer, iSLType as Integer, dStop as Double, dLimit as Double, iTrailMinMoveStop as Integer, iTrailMinMoveLimit as Integer, iTIFType as Integer, ByRef psOrderId as Variant, ByRef psDI as Variant)
IDL
[id(442)] HRESULT CreateEntryOrder4( [in]BSTR wcsAccountID, [in]BSTR wcsInstr, [in]VARIANT_BOOL vbIsBuy, [in]int iAmount, [in]double dRate, [in]int iTrailMinMove, [in]int iSLType, [in]double dStop, [in]double dLimit, [in]int iTrailMinMoveStop, [in]int iTrailMinMoveLimit, [in]int iTIFType, [out]VARIANT* psOrderId, [out]VARIANT *psDI)
Visual Basic
Sub CreateEntryOrder4Async (wcsAccountID as String, wcsInstr as String, bIsBuy as Boolean, iAmount as Integer, dRate as Double, iTrailMinMove as Integer, iSLType as Integer, dStop as Double, dLimit as Double, iTrailMinMoveStop as Integer, iTrailMinMoveLimit as Integer, iTIFType as Integer, ByRef psRequestId as Variant)
IDL
[id(443)] HRESULT CreateEntryOrder4Async( [in]BSTR sAccountID, [in]BSTR sInstrument, [in]VARIANT_BOOL vbBuy, [in]int iAmount, [in]double dRate, [in]int iTrailMinMove, [in]int iSLType, [in]double dStop, [in]double dLimit, [in]int iTrailMinMoveStop, [in]int iTrailMinMoveLimit, [in]int iTIFType, [out]VARIANT *psRequestId)

Parameters
wcsAccountID

The identifier of the account.

wcsInstrument

The instrument the order is placed for.

bIsBuy

The flag indicating whether the order is a buy order (True, a long position will be opened by this order) or sell order (False, a short position will be opened by this order).

iAmount

The amount of the order.

Please note that limitations on the amount might be applicable:

All these limitations except BaseUnitSize can be zero. Zero value means that the limitation for that specific parameter is not applied at all.

dRate

The rate at which the order is placed. The distance between the specified rate and the market must be greater than the minimal conditional distance.

You can retrieve the value of the minimal conditional distance using methods of TradingSettingsProviderAut interface.

iTrailMinMove

Controls the trailing entry order.

In case the entry order must not be trailing, specify 0 in this parameter.

In case the entry order must be trailing with a dynamic step, specify 1 in this parameter.

In case the entry order must be trailing with a fixed step, specify the size in pips of the market movement after which the order must be moved following the market. The value must be from the minimum to the maximum allowed value defined on the server. To check the values, use the methods of the TradingSettingsProviderAut interface.

Note that trailing entry orders can be not available on the server. To check whether trailing entry orders with a dynamic step are available, use the PermissionCheckerAut.CanUseDynamicTrailingForEntryStop and PermissionCheckerAut.CanUseDynamicTrailingForEntryLimit methods. To check whether trailing entry orders with a fixed step are available, use the PermissionCheckerAut.CanUseFluctuateTrailingForEntryStop and PermissionCheckerAut.CanUseFluctuateTrailingForEntryLimit methods.

iSLType

The type of the associated stop and limit order. The value defines interpretation of dStop and dLimit parameters. Can be combination of the following values:

TradeDeskAut.SL_NONE

Use this value in case neither the stop nor limit orders must be added.

TradeDeskAut.SL_STOP

Use this value in case the simple stop order must be added.

TradeDeskAut.SL_LIMIT

Use this value in case the simple limit order must be added.

TradeDeskAut.SL_PEGSTOPOPEN

Use this value in case the stop order must be the pegged stop order and its offset must be added to the open price (see Order Types for information about pegged orders).

The offset is specified in pips.

For buy orders, the stop order must be below open price minus current spread, i.e. offset must be negative and must be less than "-" spread.

For sell orders, the stop order must be above open price plus current spread. i.e. offset must be positive and must be bigger than spread.

TradeDeskAut.SL_PEGSTOPCLOSE

Use this value in case the stop order must be the pegged stop order and its offset must be added to the close price (see Order Types for information about pegged orders).

The offset is specified in pips.

For buy orders, the stop order must be below close price, i.e. offset must be negative.

For sell orders, the stop order must be above close price, i.e. offset must be positive.

TradeDeskAut.SL_PEGLIMITOPEN

Use this value in case the limit order must be the pegged limit order and its offset must be added to the open price (see Order Types for information about pegged orders).

The offset is specified in pips.

For buy orders, the limit order must be above the open price, i.e. offset must be positive.

For sell orders the limit order must be below the open price, i.e. offset must be negative.

TradeDeskAut.SL_PEGLIMITCLOSE

Use this value in case the limit order must be the pegged limit order and its offset must be added to the close price (see Order Types for information about pegged orders).

The offset is specified in pips.

For buy orders, the limit order must be above the close price plus current spread, i.e. offset must be positive and must be bigger than spread.

For sell orders, the limit order must be below the close price minus current spread. i.e. offset must be negative and must be less than "-" spread.

You can concatinate these values using arithmetical addition. For example:

To set the simple limit order only, specify in this parameter:
tradeDesk.SL_LIMIT

To set the simple limit and the simple stop orders, specify in this parameter:
tradeDesk.SL_LIMIT + tradeDesk.SL_STOP

To set the pegged stop order the offset of which will be added to the open price, specify in this parameter:
tradeDesk.SL_PEGSTOPOPEN

To set the pegged stop order the offset of which will be added to the close price and the simple limit, specify in this parameter:
tradeDesk.SL_LIMIT + tradeDesk.SL_PEGSTOPCLOSE

dStop

The rate or the offset in pips for the stop order. The interpretation of the parameter depends on the value of the iSLType parameter.

The distance between the stop level and the entry order rate must be greater than the sum of the minimal conditional distance and the current spread.

The value of the minimal conditional distance you can retrieve using methods of TradingSettingsProviderAut interface.

United States based accounts must specify 0 in this parameter. Please read NFA Compliance Rule 2-43(b). In case any other value is used Order2Go API will throw an Exception/Error.

dLimit

The rate or the offset in pips for the limit order. The interpretation of the parameter depends on the value of the iSLType parameter.

The distance between the limit level and the entry order rate must be greater than the minimal conditional distance.

The value of the minimal conditional distance you can retrieve using methods of TradingSettingsProviderAut interface.

United States based accounts must specify 0 in this parameter. Please read NFA Compliance Rule 2-43(b). In case any other value is used Order2Go API will throw an Exception/Error.

iTrailMinMoveStop

Controls the trailing stop order.

In case the stop order is not specified, specify 0 in this parameter.

In case the stop order must not be a trailing stop, specify 0 in this parameter.

In case the stop order must be trailing with a dynamic step, specify 1 in this parameter.

In case the stop order must be trailing with a fixed step, specify the size in pips of the market movement after which the order must be moved following the market. The value must be from the TradingSettingsProviderAut.GetMinTrailingStepForStop value to the TradingSettingsProviderAut.GetMaxTrailingStepForStop value.

Note that trailing stop orders can be not available on the server. To check whether trailing stop orders with a dynamic step are available, use the PermissionCheckerAut.CanUseDynamicTrailingForStop method. To check whether trailing stop orders with a fixed step are available, use the PermissionCheckerAut.CanUseFluctuateTrailingForStop method.

United States based accounts must specify 0 in this parameter. Please read NFA Compliance Rule 2-43(b). In case any other value is used Order2Go API will throw an Exception/Error.

iTrailMinMoveLimit

Controls the trailing limit order.

In case the limit order is not specified, specify 0 in this parameter.

In case the limit order must not be trailing, specify 0 in this parameter.

In case the limit order must be trailing with a dynamic step, specify 1 in this parameter.

In case the limit order must be trailing with a fixed step, specify the size in pips of the market movement after which the order must be moved following the market. The value must be from the TradingSettingsProviderAut.GetMinTrailingStepForLimit value to the TradingSettingsProviderAut.GetMaxTrailingStepForLimit value.

Note that trailing limit orders can be not available on the server. To check whether trailing limit orders with a dynamic step are available, use the PermissionCheckerAut.CanUseDynamicTrailingForLimit method. To check whether trailing limit orders with a fixed step are available, use the PermissionCheckerAut.CanUseFluctuateTrailingForLimit method.

United States based accounts must specify 0 in this parameter. Please read NFA Compliance Rule 2-43(b). In case any other value is used Order2Go API will throw an Exception/Error.

iTIFType

The Time In Force option for the entry order. The Time In Force defines how long an order will remain active before it is executed or expires. The parameter must have one of the following values:

TradeDeskAut.TIF_GTC

Use this value in case a GTC order must be created. A GTC order indicates that you want the order to remain active until executed or cancelled by you.

TradeDeskAut.TIF_DAY

Use this value in case a DAY order must be created. A DAY order indicates that you want the order to remain active until executed, cancelled by you or until the end of the trading day.

psOrderId / psRequestId

[output] Returns the identifier of the immediate order.
For CreateEntryOrder4 this parameter will return OrderID.
For CreateEntryOrder4Async this parameter will return RequestID.

psDI

[output] Returns "Y" if the order execution is delayed because of dealer intervention. This value can be returned on the dealing desk systems only.
NOTE: Only for CreateEntryOrder4 method. See declaration above.

Details

Unlike the CreateEntryOrder3/CreateEntryOrder3Async method the CreateEntryOrder4/CreateEntryOrder4Async methods allow you to choose the Time In Force for the entry order.

The CreateEntryOrder4Async method is implemented for asynchronous execution. The last output parameter will return RequestID, instead of OrderID (see declaration above). An event with this RequestID will confirm that command has been executed.

The CreateEntryOrder4 and CreateEntryOrder4Async methods are defined in the TradeDeskAut class.

back