Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 19:54:36 +0000



Problem - not every order is opening with their OCO pending orders!

View Count: 928

[2018-12-13 21:01:48]
User517260 - Posts: 97
Dear Support, I and my customer have a problem.
I use following code to place BuyStop order with Pending Stop Loss order:


//--- Set Buy Stop Order ---
s_SCNewOrder BuyStopOrder;
BuyStopOrder.OrderQuantity = LotSize.GetFloat();
BuyStopOrder.Price1 = sc.High[sc.Index-1] + EntryOffset.GetInt()*sc.TickSize;
BuyStopOrder.OrderType = SCT_ORDERTYPE_STOP;
          
if(MoveToBE.GetInt() != 0){
  BuyStopOrder.MoveToBreakEven.Type = MOVETO_BE_ACTION_TYPE_OFFSET_TRIGGERED;
  BuyStopOrder.MoveToBreakEven.TriggerOffsetInTicks      = MoveToBE.GetInt();
  BuyStopOrder.MoveToBreakEven.BreakEvenLevelOffsetInTicks  = BEOffset.GetInt();
  BuyStopOrder.MoveToBreakEven.TriggerOCOGroup= OCO_GROUP_1;
}
      
BuyStopOrder.Target1Offset     = (float)sc.RoundToIncrement(TPSize.GetInt() * sc.TickSize, sc.TickSize);
BuyStopOrder.Stop1Offset     = (float)sc.RoundToIncrement(SLSize.GetInt() * sc.TickSize, sc.TickSize);
BuyStopOrder.OCOGroup1Quantity   = 2;

int Result = (int)sc.BuyOrder(BuyStopOrder);
if (Result > 0){
  Buffer.Format(" %4d-%2d-%2d %2d:%2d:%2d Chart #%d Symbol: %s Buy Stop order #%d was OPENED SUCCESSFULLY (price level = %7.0f) ",
  sc.BaseDateTimeIn[sc.Index].GetYear(), sc.BaseDateTimeIn[sc.Index].GetMonth(), sc.BaseDateTimeIn[sc.Index].GetDay(), Hour, Minute, Second,
  sc.ChartNumber, sc.Symbol.GetChars(), BuyStopOrder.InternalOrderID, BuyStopOrder.Price1);       sc.AddMessageToLog(Buffer,1);
}  
else {
  vanPrintCodeOfError_Longs(sc, Result);
}
//-------------------------------------------


Similar code is for Short section.

A soon as user click custom button Buy - my bot open Buy Stop Order with OCO StopLoss order. As you may see on https://youtu.be/zLKas3fDLIM since 06:00 time point - it worked ok till 09:40 - Buy Stop order was opened with attached Pnding Sell Stop order (SL). BUT! Since 09:40 we may see - BuyStop orders for F.US.YMH19 and F.US.ENQH19 was opened, but without their pending SLs! It is a problem. Help me please as soon as possible, because my customer is stopped in his business because of this problem. Waiting for your reply asap! Thanks, Alex!
[2018-12-13 21:30:13]
User517260 - Posts: 97
It is second example of sdame problem https://youtu.be/wfjlOlbTqcc

it seems - this problem happens if previously placed BuyStop order with his pending SL was filled - next BuyStop order is placing without his SL.

I tested new OCO_GROUP for every new BuyStop order like:

for 1st BuyStop order BuyStopOrder.MoveToBreakEven.TriggerOCOGroup= OCO_GROUP_1;
for 2nd BuyStop order BuyStopOrder.MoveToBreakEven.TriggerOCOGroup= OCO_GROUP_2;
for 3rd BuyStop order BuyStopOrder.MoveToBreakEven.TriggerOCOGroup= OCO_GROUP_3;

but it didn't decide a problem...
Date Time Of Last Edit: 2018-12-13 22:35:52
[2018-12-13 22:43:11]
Sierra Chart Engineering - Posts: 104368
Do not set this:
BuyStopOrder.OCOGroup1Quantity = 2;

Since you are using:

BuyStopOrder.MoveToBreakEven.Type = MOVETO_BE_ACTION_TYPE_OFFSET_TRIGGERED;

Do not use:

for 1st BuyStop order BuyStopOrder.MoveToBreakEven.TriggerOCOGroup= OCO_GROUP_1;
for 2nd BuyStop order BuyStopOrder.MoveToBreakEven.TriggerOCOGroup= OCO_GROUP_2;
for 3rd BuyStop order BuyStopOrder.MoveToBreakEven.TriggerOCOGroup= OCO_GROUP_3;

And set this in the code to 0:
ACSIL Interface Members - Variables and Arrays: sc.SupportTradingScaleIn
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
[2018-12-14 16:17:11]
User517260 - Posts: 97
Thanks a lot!

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

Login

Login Page - Create Account