Welcome Guest, you are in: Login
CTS Futures
Home
Pricing
FAQ

T4 Desktop
User Guide
Scripting Guide
Release Notes

Mobile and Web
T4 Mobile
T4 WebTrader

Admins
T4 Admin Guide

Developers
API 4.0 Guide
API 4.0 Reference
FIX API




Search the wiki
»
To submit an AutoOCO order you need to use an order batch. An AutoOCO consists of three orders, the first is a trigger order. When that fills the second and third orders are submitted as an OCO. Effectively this allows you to enter a position and automatically exit it.

' Create the batch submission object.
Dim oBatch As OrderList.Submission
oBatch = moAccounts.SubmitOrders(oAccount, oMarket)

' Set the batch linking type.
oBatch.OrderLink = OrderLink.AutoOCO

' Add the trigger order to the batch.
moOrder = oBatch.Add(BuySell.Sell, _
PriceType.Limit, _
TimeType.Normal, _
1, _
CDbl(107000))

' Add the limit order to the batch.
moOrder1 = oBatch.Add(BuySell.Buy, _
PriceType.Limit, _
TimeType.Normal, _
0, _
CDbl(-100))

' Add the stop order to the batch.
moOrder2 = oBatch.Add(BuySell.Buy, _
PriceType.StopMarket, _
TimeType.Normal, _
0, _
0, _
CDbl(100)
OpenClose.Undefined, _
"", _
0, _
ActivationType.Immediate, _
"")

' Submit the batch.
oBatch.Submit()

The Add parameter details are described here:

This batch submits an AutoOCO with a trigger sell limit order at 107000. When this fills the remaining two orders are submitted as an OCO with prices that are the fill price of the trigger order plus the prices specified for those orders. If the trigger order is only partially filled then the OCO is submitted with the appropriate volume. If the trigger order fills further then the OCO volumes are adjusted. If the trigger is only partially filled when one of the OCO orders gets a fill then the trigger order is cancelled.

Please note:
  • Volumes for the two OCO orders should be specified as 0. The system works out what the volumes need to be based on the trigger order.
  • Prices for the two OCO orders are specified as a differential from the fill price of the trigger order. This allows for you not knowing what price the trigger order will fill at, for example, if you use a market order, or even a Trailing StopMarket, as the trigger order..

You can also make these orders GTC's, StopLimit or Trailing. Trigger order can be any order type, including Activation, Stop and Trailing Stop.

Please note that OCO's are not intended to be used where both orders are very close together, for example at consecutive prices or at the best bid and best offer prices. It is likely that you would get filled on both orders in an active market in that scenario.

Trade how you want, where you want

support@ctsfutures.com (312) 939 0164

141 W. Jackson Blvd., Suite 211A, Chicago, IL 60604

© 2009-2012 Cunningham Trading Systems Inc. All rights reserved.