Login Page - Create Account

Support Board


Date/Time: Fri, 07 Feb 2025 18:03:35 +0000



Post From: ACSIL - Internal Order ID given to sc.ModifyOrder is 0

[2020-06-05 15:17:58]
User704508 - Posts: 20
I recompiled every strategy that I have but it did not fix the issue.

Do you think it might be a problem because of the code below? I created this because I had issues with order reversing themselves when getting flat and I didn't want any open orders without stop losses running around.

I tested it and never had any problem before but I don't see any other solution here.

s_SCTradeOrder OrderDetails;
    int Index = 0;
    if(PositionData.PositionQuantity != 0)
    {
      while(sc.GetOrderByIndex(Index, OrderDetails) != SCTRADING_ORDER_ERROR)
      {
        Index++; // increment the index
        
        if (OrderDetails.OrderStatusCode == SCT_OSC_OPEN)
        {
          openOrder = 1;
          break;
        }
      }
      
      if(openOrder == 0)
      {
        sc.FlattenAndCancelAllOrders();
      }
    }

Date Time Of Last Edit: 2020-06-05 15:35:29