Login Page - Create Account

Support Board


Date/Time: Wed, 15 Jan 2025 20:47:06 +0000



Unable to reverse entries

View Count: 994

[2017-09-12 15:50:19]
User203925 - Posts: 40
I would like for my code to reverse entries but right now I am unable to get it to work. The code does short / long but does not reverse. Here is my code and defaults. Any help would be appreciated. I have been at this for 2 days and for some reason I can't get this to work.


sc.GraphRegion = 0;
sc.AutoLoop = true;
sc.FreeDLL = 1;
sc.AllowMultipleEntriesInSameDirection = false;
sc.AllowOnlyOneTradePerBar = true;
sc.MaintainTradeStatisticsAndTradesData = true;
sc.AlertOnlyOncePerBar = true;
sc.SupportReversals = true;
//sc.MaximumPositionAllowed = 5;
sc.AllowOppositeEntryWithOpposingPositionOrOrders = false;
sc.CancelAllOrdersOnEntriesAndReversals = true;
sc.AllowEntryWithWorkingOrders = false;
sc.CancelAllWorkingOrdersOnExit = true;



NewOrder.OrderQuantity = OrderQuantity.GetInt();
NewOrder.OrderType = SCT_ORDERTYPE_MARKET;
NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED;

s_HardStop = (LowestLow[sc.Index] - (StopTickOffset.GetInt() * sc.TickSize));
b_HardStop = (HighestHigh[sc.Index] + (StopTickOffset.GetInt() * sc.TickSize));
TargetPrice1 = (TargetLimit.GetInt()* sc.TickSize);


if (DB[sc.Index] == 1 && DT[sc.Index] == 0) {

TradePrice = sc.BaseData[SC_LAST][sc.Index];

int Result = sc.BuyOrder(NewOrder);

    

    if (Result > 0 && NewOrder.InternalOrderID != 0)
    {

      
      Target1OrderID = NewOrder.Target1InternalOrderID;
      Stop1OrderID = NewOrder.StopAllInternalOrderID;
      EntryID = NewOrder.InternalOrderID;


    
    }

if (DT[sc.Index] == 1 && DB[sc.Index] == 0) {

s_TradePrice = sc.BaseData[SC_LAST][sc.Index];

      

      NewOrder.Target1Offset = TargetPrice1;
      NewOrder.StopAllPrice = b_HardStop;
      NewOrder.OCOGroup1Quantity = 1;


      int Result = sc.SellOrder(NewOrder);

      


      if (Result > 0 && NewOrder.InternalOrderID != 0)
      {


        Target1OrderID = NewOrder.Target1InternalOrderID;
        Stop1OrderID = NewOrder.StopAllInternalOrderID;
        EntryID = NewOrder.InternalOrderID;


      

      }




[2017-09-12 20:53:12]
Sierra Chart Engineering - Posts: 104368
In regards to:
sc.SupportReversals = true;

Here is the relevant documentation:
Automated Trading Management: SupportReversals
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2017-09-13 15:48:22]
User203925 - Posts: 40
Thank you for the help and the reply! In my case sc.AllowEntryWithWorkingOrders had to be set to true. I honestly do not know why but it works now with this default set to true. Thank you for the help though. You guys are always good at helping answer questions on the platform no matter how trivial they be sometimes.
[2017-09-13 17:10:43]
Sierra Chart Engineering - Posts: 104368
This section here is also helpful:
http://www.sierrachart.com/index.php?page=doc/ACSILTrading.html
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account