Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 22:28:03 +0000



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

[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!