Login Page - Create Account

Support Board


Date/Time: Thu, 28 Nov 2024 08:00:28 +0000



Post From: Automated Trading From an Advanced Custom Study::Cancel bug or user error/misunderstanding

[2023-05-25 04:25:04]
lakenymph - Posts: 2
The following function seems to be a reasonable workaround:

  bool SetSCTradeOrder(SCStudyInterfaceRef sc, int const ordID, s_SCTradeOrder &ord)
  {
sc.GetOrderByOrderID(ordID, ord);

    if (ord.OrderType == SCT_OSC_UNSPECIFIED || ord.InternalOrderID != ordID)
    { //Search by 2nd method:
      int Index = 0;
      while (sc.GetOrderByIndex(Index, ord) != SCTRADING_ORDER_ERROR)
      {
        Index++;
        if (ord.InternalOrderID == ordID)
          break;
      }
    }

    return ord.InternalOrderID == ordID;
  }