Login Page - Create Account

Support Board


Date/Time: Fri, 22 Nov 2024 19:09:13 +0000



Post From: parent order issue ver 971

[2013-05-16 10:03:38]
User32496 - Posts: 26
when running my code i get this error which has to do with parent and attached orders, yet 2 min. later the signal shows on chart and order is sent correctly (buy/sell 2 mkt + target 1 +2 on limit + stop + trailing_stop_limit + oco all)
what have i done wrong?
thanks

Error log
Trade Order Error: The order quantity for the Parent is 1 and this is less than the total order quantity of 2 for the Attached Orders. Please adjust the order quantities so the parent is greater or equal to the Attached Orders. | 2013-05-16 05:48:49

here is the orders code (which was copied from an example)

// Create an s_SCNewOrder object.
  s_SCNewOrder NewOrder;
  NewOrder.OrderQuantity = OrderQuantity.GetInt();
  NewOrder.OrderType = SCT_MARKET;
  
  //Define the Attached Orders to be attached to the main Market order
  //Target 1
  NewOrder.Target1Offset = tPriceInput.GetFloat()*sc.TickSize;
  NewOrder.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;

  //Target 2
  NewOrder.Target2Offset = target2PriceInput.GetFloat()*sc.TickSize;
  NewOrder.AttachedOrderTarget2Type = SCT_ORDERTYPE_LIMIT;

  //Common Stop
  NewOrder.StopAllOffset = stopPriceInput.GetFloat()*sc.TickSize;
  NewOrder.AttachedOrderStopAllType = SCT_ORDERTYPE_TRIGGERED_TRAILING_STOP_LIMIT_3_OFFSETS;
  NewOrder.TriggeredTrailStopTriggerPriceOffset=stopPriceInput.GetFloat()*sc.TickSize;
  NewOrder.TriggeredTrailStopTrailPriceOffset=trailPriceInput.GetFloat()*sc.TickSize;

  //Set up a move to breakeven action for the common stop
  NewOrder.MoveToBreakEven.Type=MOVETO_BE_ACTION_TYPE_OCO_GROUP_TRIGGERED;
  NewOrder.MoveToBreakEven.BreakEvenLevelOffsetInTicks= bePriceInput.GetFloat();
  //When Target 1 is filled, the order will be moved to breakeven +1
  NewOrder.MoveToBreakEven.TriggerOCOGroup= OCO_GROUP_1;