Login Page - Create Account

DTC Protocol Discussion Forum


Date/Time: Tue, 21 May 2024 04:28:29 +0000



[Programming Help] - DTC - Market order with Stop and Take Profit (Broken since update)

View Count: 3446

[2020-07-06 11:19:25]
User667559 - Posts: 27
This worked like a charm before a recent uppdate.

My goal is to enter with a market order and place a bracket around it by using an offset of 9 STOP ticks and 12 Profit ticks.

Sending to Sierra: {
Type: 208,
Symbol: 'NQU20_FUT_CME',
ClientOrderID: 89806686953,
OrderType: 1,
BuySell: 1,
Quantity: 1,
Price1: '10474.50',
TradeAccount: 'Sim1',
IsParentOrder: 1,
RequestID: 18
}
Sending to Sierra: {
Type: 201,
Symbol: 'NQU20_FUT_CME',
ClientOrderID_1: 18436358413,
OrderType_1: 3,
BuySell_1: 2,
Quantity_1: 1,
OffsetFromParent1: 225,
ClientOrderID_2: 6511723183,
OrderType_2: 2,
BuySell_2: 2,
Quantity_2: 1,
OffsetFromParent2: 300,
TimeInForce: 1,
ParentTriggerClientOrderID: 89806686953,
PartialFillHandling: 0,
UseOffsets: 1,
TradeAccount: 'Sim1',
RequestID: 19
}


I had this working but now I get the following error for my orders:
data.OrderStatus 9 {
Type: 301,
RequestID: 0,
TotalNumMessages: 1,
MessageNumber: 1,
OrderStatus: 9,
OrderUpdateReason: 8,
OrderType: 0,
BuySell: 0,
Price1: null,
Price2: null,
TimeInForce: 0,
GoodTillDateTime: 0,
OrderQuantity: null,
FilledQuantity: null,
RemainingQuantity: null,
AverageFillPrice: null,
LastFillPrice: null,
LastFillDateTime: 0,
LastFillQuantity: null,
NoOrders: 0,
Symbol: 'NQU20_FUT_CME',
Exchange: '',
ServerOrderID: '',
ClientOrderID: '18436358413',
ExchangeOrderID: '',
LastFillExecutionID: '',
TradeAccount: 'Sim1',
InfoText: 'OCO order not allowed with market parent order when using offsets',
ParentServerOrderID: '',
OCOLinkedOrderServerOrderID: '',
OpenOrClose: 0,
PreviousClientOrderID: '',
FreeFormText: '',
OrderReceivedDateTime: 0,
LatestTransactionDateTime: 0
}
data.OrderStatus 9 {
Type: 301,
RequestID: 0,
TotalNumMessages: 1,
MessageNumber: 1,
OrderStatus: 9,
OrderUpdateReason: 8,
OrderType: 0,
BuySell: 0,
Price1: null,
Price2: null,
TimeInForce: 0,
GoodTillDateTime: 0,
OrderQuantity: null,
FilledQuantity: null,
RemainingQuantity: null,
AverageFillPrice: null,
LastFillPrice: null,
LastFillDateTime: 0,
LastFillQuantity: null,
NoOrders: 0,
Symbol: 'NQU20_FUT_CME',
Exchange: '',
ServerOrderID: '',
ClientOrderID: '6511723183',
ExchangeOrderID: '',
LastFillExecutionID: '',
TradeAccount: 'Sim1',
InfoText: 'OCO order not allowed with market parent order when using offsets',
ParentServerOrderID: '',
OCOLinkedOrderServerOrderID: '',
OpenOrClose: 0,
PreviousClientOrderID: '',
FreeFormText: '',
OrderReceivedDateTime: 0,
LatestTransactionDateTime: 0
}
data.OrderStatus 9 {
Type: 301,
RequestID: 0,
TotalNumMessages: 1,
MessageNumber: 1,
OrderStatus: 9,
OrderUpdateReason: 8,
OrderType: 0,
BuySell: 0,
Price1: null,
Price2: null,
TimeInForce: 0,
GoodTillDateTime: 0,
OrderQuantity: null,
FilledQuantity: null,
RemainingQuantity: null,
AverageFillPrice: null,
LastFillPrice: null,
LastFillDateTime: 0,
LastFillQuantity: null,
NoOrders: 0,
Symbol: 'NQU20_FUT_CME',
Exchange: '',
ServerOrderID: '',
ClientOrderID: '89806686953',
ExchangeOrderID: '',
LastFillExecutionID: '',
TradeAccount: 'Sim1',
InfoText: 'OCO order not allowed with market parent order when using offsets',
ParentServerOrderID: '',
OCOLinkedOrderServerOrderID: '',
OpenOrClose: 0,
PreviousClientOrderID: '',
FreeFormText: '',
OrderReceivedDateTime: 0,
LatestTransactionDateTime: 0
}


Please explain the steps I need to take to realize the above scenario using DTC.
1. Enter with market order
2. Create OCO bracket around the average price

When I created this the first time I had to provide the current market price instead of just a Market order so Sierra could calculate the offsets correctly. This seemed odd, and the error message now confirms that. Hope you guys can offer me a solution. The recent update broke my program.
Date Time Of Last Edit: 2020-07-06 11:24:01
[2020-07-10 11:44:57]
User667559 - Posts: 27
I tried entering with a regular market order, then read the fillprice that I get back and then submit an OCO order, this works fine except for one thing.
1. When I remove/cancel my take profit order it also kicks out my stop order.
2. This doesn't happen when I use the [BUY MKT] button in Sierra itself. So I guess there it is connected correctly.

How am I supposed to enter with a market order and place a bracket around the fill price that allows for one order to be taken off without removing the other? Although on fill it does cancel the other one...?
[2020-07-16 18:50:40]
Sierra Chart Engineering - Posts: 104368
I tried entering with a regular market order, then read the fillprice that I get back and then submit an OCO order, this works fine except for one thing.
Do not do it this way.


This is the reason for the problem:
InfoText: 'OCO order not allowed with market parent order when using offsets',

It is required that there is a price reference for the offsets to calculate the actual order prices. In the case of a market order although a price can be specified, it is not considered to necessarily be reliable.

So do not use offsets by specifying UseOffsets: 0. And specify the actual prices with: Price1_1, Price1_2. If you know the point of reference for the offsets and the offsets as well, it is very easy to calculate the actual OCO order prices.

Also for your information, refer to PartialFillHandling:
Order Entry and Modification Messages: SUBMIT_NEW_OCO_ORDER [s_SubmitNewOCOOrder structure] Client >> Server
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2020-07-16 18:53:12
[2020-07-17 08:33:47]
User667559 - Posts: 27
Yeah but when I submit the actual fixed prices of my OCO beforehand based on the current Market price, they might be off considerably (distance wise) when my Market order doesn't fill on the current market price cause of high speed price movement.

Ideally I just want to send out a MARKET order with offsets and let the system do its things. But I guess that's impossible.

You are now saying I need to submit my OCO in advance even though I have no clue what my AveragePosition will be? Is this really how Sierra does this internally as well?
[2020-07-24 20:13:27]
DTC Engineering - Posts: 320
Sierra Chart does use the price given with the market order to determine what the actual prices are for the Target and Stop orders when offsets are specified for the Target and Stop orders.

However, when the parent order fills, the Target and Stop prices will be updated to maintain the same offsets they had originally to the parent order price. So it is perfectly fine to calculate the prices ahead of time, and they will be updated on the parent fill. So be sure to specify a Price1 with the market order to ensure the offsets are calculated and will be maintained on a parent order fill. It does not matter if any of the order prices are correct. It is the relationship between them that counts.
Date Time Of Last Edit: 2020-07-24 20:26:51
[2020-07-31 11:23:22]
User667559 - Posts: 27
Well, this almost works I guess, the Stop order is adjusted correctly, the take profit is miles away, always 400 ticks it seems.

Sending to Sierra: {
Type: 208,
Symbol: 'MESU20_FUT_CME',
ClientOrderID: '766283507691000',
OrderType: 1,
BuySell: 1,
Quantity: 1,
Price1: 10000,
TradeAccount: 'Sim1',
IsParentOrder: 1,
RequestID: 14
}
Sending to Sierra: {
Type: 201,
Symbol: 'MESU20_FUT_CME',
ClientOrderID_1: 58880356016,
OrderType_1: 3,
Price1_1: 9825,
BuySell_1: 2,
Quantity_1: 1,
ClientOrderID_2: 21407561993,
OrderType_2: 2,
BuySell_2: 2,
Price2_1: 10250,
Quantity_2: 1,
TimeInForce: 1,
PartialFillHandling: 1,
TradeAccount: 'Sim1',
ParentTriggerClientOrderID: '766283507691000',
RequestID: 15
}

The result is:
Stop at 7 ticks away minus (correct),
Take Profit at 400 ticks away plus (huh?)

See attachment. I'm not sure how else I need to approach this since I followed exactly what was written above. one original price, and two offsets in the OCO request


In addition, it doesn't seem to matter what price I give in Price2_1, the order is always 400 ticks away.
Date Time Of Last Edit: 2020-08-01 09:40:48
image2020-07-31 13_21_08-__._DISPLAY1.png / V - Attached On 2020-07-31 11:22:35 UTC - Size: 4.69 KB - 659 views
[2020-08-07 07:54:58]
Sierra_Chart Engineering - Posts: 14436
We would need to test this. But not sure why there is a problem because if you run a sub instance of Sierra Chart with File >> New Instance and submit a market order with Attached Orders when not in Trade Simulation Mode, then the Attached Orders will have correct prices after the parent order fills.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2020-08-07 07:55:57
[2021-01-17 10:42:30]
RoadKill - Posts: 38
Has this been "tested" and fixed?
[2021-01-19 10:00:57]
DTC Engineering - Posts: 320
We cannot identify any problem but make that the first order in the OCO order a limit order and the second order a stop order. But we do not know why that would make a difference but we are testing using that order of orders.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account