Login Page - Create Account

Support Board


Date/Time: Sat, 18 May 2024 16:54:39 +0000



Post From: Multiple attached entry orders

[2018-05-14 20:56:10]
User39772 - Posts: 311
Hello Support,

on my entry signal I try to execute 2 independent entry orders wit a trailing stops each based on the following code:

sc.AllowMultipleEntriesInSameDirection = true;
sc.AllowOnlyOneTradePerBar = false;
sc.AllowEntryWithWorkingOrders = true;
sc.SupportAttachedOrdersForTrading = true;

if (Entry == true)

{

s_SCNewOrder NewOrder;
NewOrder.OrderQuantity = 1;
NewOrder.OrderType = SCT_ORDERTYPE_MARKET;
sc.CancelAllWorkingOrdersOnExit = true;
NewOrder.AttachedOrderStop1Type = SCT_ORDERTYPE_TRAILING_STOP;
NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED;
NewOrder.Stop1Offset = StopValue.GetFloat() * sc.TickSize;
...
Buy Entry(NewOrder);
...

s_SCNewOrder NewOrder1;
NewOrder1.OrderQuantity = 1;
NewOrder1.OrderType = SCT_ORDERTYPE_MARKET;
NewOrder1.AttachedOrderStop1Type = SCT_ORDERTYPE_TRAILING_STOP;
NewOrder1.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED;
NewOrder1.Stop1Offset = StopValue.GetFloat() * sc.TickSize;
...
Buy Entry(NewOrder1);
...

}

During Replay I see an open position of 2 (= the sum of both orders) but only a trailing stop with a size = 1.
If that trailing stop is hit, the open position is reduced by 1 but the 2nd positin remains open with no TS.

Do you see any mistake or misunderstanding on my side regarding the use of the functions ?