Login Page - Create Account

Support Board


Date/Time: Thu, 28 Mar 2024 08:28:28 +0000



[Programming Help] - Send Attached Orders By Position

View Count: 853

[2021-01-08 23:22:08]
User184576 - Posts: 20
Hi,

I have an open bracket order with a target and a hard stop.

At a certain point, I would like to cancel the hard stop and add an attached trailing stop.

I can do this manually in the chart by enabling "Send Attached Orders By Position".

However, I am having trouble implementing this via ACSIL in a custom study.

I've tried modifying the parent order as per below, however it does not seem to be working.

Is this even a possible using ACSIL?

If so, any assistance would be appreciated.

Thank you.

Sample:

//Cancel Hard Stop

int Result = sc.CancelOrder(StopOrderID);

//Initiate New Trailing Stop Order To Open Parent Order

s_SCNewOrder OpenParentOrder;
OpenParentOrder.InternalOrderID = OpenParentOrderID;
OpenParentOrder.AttachedOrderStopAllType = SCT_ORDERTYPE_TRAILING_STOP;
float stopOffset = 50.0;
OpenParentOrder.StopAllOffset = stopOffset;
int Result2 = (int)sc.SellEntry(OpenParentOrder);;
Date Time Of Last Edit: 2021-01-08 23:33:54
[2021-01-10 21:45:49]
bradh - Posts: 846
You need to modify the stop order, it gets its own OrderID after the parent order is submitted.
[2021-01-11 23:39:09]
User184576 - Posts: 20
Hi,

I believe I can only modify the price and quantity on the existing "attached" stop order?

So, my thought was to cancel the existing hard stop and replace it with a new "attached" trailing stop, so that the relation between my targets and a stop is retained.

Am I incorrect that only price & quantity can be modified.

Can I convert a hard stop into a trailing stop?

Any assistance is much appreciated.

Thanks!

//Cancel Hard Stop

int Result = sc.CancelOrder(StopOrderID);

//Initiate New Trailing Stop Order To Open Parent Order

s_SCNewOrder OpenParentOrder;
OpenParentOrder.InternalOrderID = OpenParentOrderID;
OpenParentOrder.AttachedOrderStopAllType = SCT_ORDERTYPE_TRAILING_STOP;
float stopOffset = 50.0;
OpenParentOrder.StopAllOffset = stopOffset;
int Result2 = (int)sc.SellEntry(OpenParentOrder);;
[2021-01-11 23:47:55]
bradh - Posts: 846
What makes it a hard stop? Your study can modify the price, and manage the stop.

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

Login

Login Page - Create Account