Login Page - Create Account

Support Board


Date/Time: Sat, 12 Jul 2025 09:11:42 +0000



Post From: Reversal Order in ACSIL not getting created with Attached Orders

[2025-07-09 23:10:19]
rajeshh - Posts: 14
Thanks to User431178 pointing out the infinite while loop, the Sierra Chart hanging issue is resolved.

Now I am having issues with the opposite parent order not having its attached orders, and instead acting almost like a scaleout order. See https://www.sierrachart.com/image.php?Image=1752101744763.png , where there are qty 4 long position, after 3 bull bars, and scaling in on the close of the bear bar. The opposite sell order at the low of the bear bar shows up in the Attached Stop Order as TQ 5. I would like this to appear as its own order with an attached buy limit and buy stop order above.

I have included the snippet of the code below, which creates the long scale-in order at the close of the bear bar, and then sets TradingScaleOut to false, and submits the opposite order.
I have also attached a version of the cpp file with changes. Thanks


  //Next create a scale in Long Order
        int Result;
        s_SCNewOrder scaleInOrder;
        scaleInOrder.OrderQuantity = 1;
        scaleInOrder.OrderType = SCT_ORDERTYPE_STOP;
        //scaleInOrder.TimeInForce = TIF_GOOD_TILL_DATE_TIME;
        scaleInOrder.Price1   = sc.Close[n];
        //SCDateTime barDuration = sc.BaseDateTimeIn[n] - sc.BaseDateTimeIn[n - 1];
        //scaleInOrder.GoodTillDateTime = sc.BaseDateTimeIn[n+1] + barDuration;
        
        msg.Format("index=%u,Long Position Scalein: Price = %f, Prior Quantity = %f", n,scaleInOrder.Price1, PositionData.PositionQuantity);
        sc.AddMessageToLog(msg, 1);
        
        Result = static_cast<int>(sc.BuyEntry(scaleInOrder));
        
        
        //Adding the below to see if it would make the new Opposite order have its own attached orders, and not scale out.
        sc.SupportTradingScaleOut = false;         
        
        //Next create a new Short Order, below thw low of the bear bar.
        // Create an s_SCNewOrder object.
        s_SCNewOrder NewOrder;
        NewOrder.OrderQuantity = 1;
        NewOrder.OrderType = SCT_ORDERTYPE_STOP;
        //NewOrder.TimeInForce = TIF_GOOD_TILL_DATE_TIME;
        
        //SCDateTime barDuration = sc.BaseDateTimeIn[n] - sc.BaseDateTimeIn[n - 1];
        //NewOrder.GoodTillDateTime = sc.BaseDateTimeIn[n+1] + barDuration;
        NewOrder.Price1 = sc.Low[n] - sc.TickSize;  //In this case, simplifying this to be a buy Stop order above the high of the bar.
        
        NewOrder.Target1Price =NewOrder.Price1 - RoundToMinTick(avgBarSize) ;
        NewOrder.Stop1Price = sc.High[n] + RoundToMinTick(2*avgBarSize);
        
        msg.Format("index=%u,Opposite Short Order: Price = %f, Prior Quantity = %f", n,NewOrder.Price1 , PositionData.PositionQuantity);
        sc.AddMessageToLog(msg, 1);
        
        Result = static_cast<int>(sc.SellEntry(NewOrder));

Date Time Of Last Edit: 2025-07-09 23:11:10
attachmentRVH-opposing-orders.cpp - Attached On 2025-07-09 23:10:12 UTC - Size: 16.18 KB - 7 views