API Support Forum
OEC API > Order Execution > Error In TrailingStopLoss order type
Author Topic: Error In TrailingStopLoss order type
(2 messages, Page 1 of 1)
Moderators: VPfau
BGoyal9136
Posts: 27
Joined: Sep 21, 2017


Posted: Apr 27, 2020 @ 10:36 AM             Msg. 1 of 2
Hi Team ,

I hope you are doing well.
I am getting below error while I am placing order as TrailingStopLoss .Please let me know. what I am doing wrong:

TrailingStopData and either TrailingStopLimit or TrailingStopLoss must be defined together


Order Draft :

OrderDraft slOrder = new GF.Api.Orders.Drafts.OrderDraft(OrderSide.Buy,
order.Contract.ID, "comment", order.Account.ID, null, null, 2.0, OrderType.TrailingStopLoss,
_price, null, OrderFlags.GTC, ExecInst.None, null, null, null, null, null, null, SubmissionType.Automatic, null, null);


Thanks
Kapil Goyal
RBduov
Posts: 6
Joined:


Posted: Apr 28, 2020 @ 07:52 AM             Msg. 2 of 2
Looks like you are trying to pass a TrailingStopData trailingStopData parameter as null.
https://gainfutures.com/GFAPI/html/M_GF_Api_Orders_Drafts_OrderDraft__ctor.htm

To create order, adjusted to the market price its need to set two components is 'price' and 'delta'.
Please use a TrailingStopData Class to set the values.
https://gainfutures.com/GFAPI/html/M_GF_Api_Orders_ExtendedData_TrailingStopData__ctor.htm

Thanks for reaching out.
_____________________________________________
Ruslan Bduov