Login Page - Create Account

Support Board


Date/Time: Tue, 23 Jan 2018 13:59:20 +0000



Post From: MARKET IF TOUCHED OCO

[2017-12-18 12:47:41]
User28317 - Posts: 58
I have a study that places automated OCO Trades. Target Order should be set to Limit, Stop to Market If Touched. The orders are placed mostly correctly with the exception of the Stop order, which is placed as Limit. I tried to force the Market If touched type, and explicitely set all Stop Order Groups to Merket If touched, but it doesn't change anything.

The relevant code is:

  // Setting price for entry, target and stop
  // ...
  order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;
  order.AttachedOrderStop1Type = SCT_ORDERTYPE_MARKET_IF_TOUCHED;
  order.AttachedOrderTarget2Type = SCT_ORDERTYPE_LIMIT;
  order.AttachedOrderStop2Type = SCT_ORDERTYPE_MARKET_IF_TOUCHED;
  order.AttachedOrderTarget3Type = SCT_ORDERTYPE_LIMIT;
  order.AttachedOrderStop3Type = SCT_ORDERTYPE_MARKET_IF_TOUCHED;
  order.AttachedOrderTarget4Type = SCT_ORDERTYPE_LIMIT;
  order.AttachedOrderStop4Type = SCT_ORDERTYPE_MARKET_IF_TOUCHED;

  order.AttachedOrderStopAllType = SCT_ORDERTYPE_MARKET_IF_TOUCHED;

  order.OCOGroup1Quantity = 1;
  order.OrderQuantity = t.amount_;
  
  if (sc.BuyEntry(order) < 0)
      sc.AddMessageToLog("Failed to submit order to the trading service.", 0);

What exactly am I doing wrong?