Login Page - Create Account

Support Board


Date/Time: Fri, 22 Nov 2024 21:18:25 +0000



Post From: Problems modifying an order has just caused a CPU exception

[2019-04-01 23:00:33]
User145885 - Posts: 15
Hi.I am new with ACSIL coding.I would like to place a manual MKT order or limit order and modify it using ACSIL or if possible attach child orders to it after the order has been accepted/executed .When the code execute the order there is no problem attaching or controlling.

The warnings occurs when I try to modify it after either executed by me manually or when a limit order have been triggered.
I am receiving the following message :

From Message log:
Chart: Replay 120X: YMM19 [M] 144 Volume #6 | Study: Trading CrossOver Example | ORDERID1 is 27726,FillPrice5 is 25853.000000 | 2019-04-01 16:49:57
Warning: The Custom DLL study "MEntry_64.scsf_SC_TradingCrossOverExample" has just caused a CPU exception. | 2019-04-01 16:49:57 *
Warning: This Custom DLL study may cause Sierra Chart to be unstable until you remove the study from your chart and restart Sierra Chart. | 2019-04-01 16:49:57 *

From Trade service log:
Order modification failed | Unable to modify order because it is no longer working. Internal Order ID: 27726. Service Order ID: 27726. Symbol: YMM19 | 2019-04-01 16:49:49 *

If there is a way to attach child orders to an existing order or a function That I could use to accomplish what I need,Please let me know.I really appreciate it.Thanks in advance.

This is what I am using at the moment to modify the order.
s_SCTradeOrder ExistingOrder1;
    
while( sc.GetOrderByIndex(OrderIndex1, ExistingOrder1) != SCTRADING_ORDER_ERROR)
{
++OrderIndex1;
  OrderID1 = ExistingOrder1.InternalOrderID;
}

if (ExistingOrder1.BuySell == BSE_BUY)
      
NewLimit1 = FillPrice5 + sc.TickSize*30;
NewLimit2 = FillPrice5 - sc.TickSize*30;}
else if (ExistingOrder1.BuySell == BSE_SELL)
{  
NewLimit1 = FillPrice5 - sc.TickSize*30;
NewLimit2 = FillPrice5 + sc.TickSize*30;
      
}
s_SCNewOrder ModifyOrder;

ModifyOrder.InternalOrderID = OrderID1;
ModifyOrder.Price1 = NewLimit1;
//ModifyOrder.OrderType = SCT_ORDERTYPE_LIMIT;
sc.ModifyOrder(ModifyOrder);
ModifyOrder.Price2 = NewLimit2;
sc.ModifyOrder(ModifyOrder);
SCString MessageText2;
MessageText2.Format("NewLimit1 is %f",NewLimit1);
sc.AddMessageToLog(MessageText2, 0);