Login Page - Create Account

Support Board


Date/Time: Mon, 12 May 2025 05:38:11 +0000



Post From: ASCIL Trailing Stops Question

[2024-09-17 00:57:38]
ForgivingComputers.com - Posts: 1058
int MoveStop(SCStudyInterfaceRef sc, const int OrderID, const double SetStopPrice)
{
  // Look Up Stop Order to see if Open EXIT if not result = -1
  s_SCTradeOrder TradeOrder;
  sc.GetOrderByOrderID(OrderID, TradeOrder);
  if (TradeOrder.OrderStatusCode != SCT_OSC_OPEN)
  {
    return -1;
  }

  // Look Up Previous Stop Price
  double PrevStop = TradeOrder.Price1;
  double NewStop = sc.RoundToTickSize(SetStopPrice, sc.TickSize);
  int result = 0;

  // Compare To SetStopPrice if Equal Result = 0
  if (PrevStop == NewStop)
  {
    return 0;
  }


    // // Create ModifyOrder
    s_SCNewOrder ModifyOrder;
    ModifyOrder.InternalOrderID = OrderID;
    ModifyOrder.Price1 = NewStop;
    result = sc.ModifyOrder(ModifyOrder);

  
    return result;
}