Login Page - Create Account

Support Board


Date/Time: Sun, 09 Mar 2025 20:34:45 +0000



[Programming Help] - Attached Stop

View Count: 497

[2022-03-11 20:53:06]
User39772 - Posts: 311
Hello,

I implemented an attached stop with the following code:

NewOrder.Stop1Offset = Input_InitialStop.GetFloat() * sc.TickSize;
NewOrder.AttachedOrderStop1Type = SCT_ORDERTYPE_STOP;

The exit in profit is based on :

LastTradePrice >= PositionData.AveragePrice + Input_TargetValue.GetFloat()

i.e. no attached target order.

I see the following behavior:

With an attached Target order it works as expected.
With the code above, the Trade Activity Log does only show positions that where closed by the attached stop.

Is it necessary to cancel a pending attached stop order, if the position is closed in profit manually
or what could be the cause for that behavior ?
[2022-03-12 04:12:25]
1+1=10 - Posts: 270
Is it necessary to cancel a pending attached stop order, if the position is closed in profit manually?

If you want all working orders to be canceled when you use sc.BuyExit()/sc.SellExit(), then you can set sc.CancelAllWorkingOrdersOnExit = true;

Docs here: Automated Trading Management: CancelAllWorkingOrdersOnExit

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

Login

Login Page - Create Account