Login Page - Create Account

Support Board


Date/Time: Fri, 26 Apr 2024 13:17:38 +0000



[Programming Help] - more than one limit order on the same Bar Order over ACSIL

View Count: 757

[2019-08-23 02:36:47]
User681685 - Posts: 12
hi.... sorry for my english first.

I have a Problem to send 2 or more diffrent limit Order over ACSIL.
Not the same Price!
in Trading-log i become ok and diffrent ID, but the second order change the first one. and i dont know why...
I cant testing it in Live with this bug. but i dont know its the problem in Replay, or Sim, or in my code...

are there wrong settings?

my Settings are:

sc.AllowEntryWithWorkingOrders = true;
sc.AllowMultipleEntriesInSameDirection = true;
sc.CancelAllWorkingOrdersOnExit = false;
sc.AllowOnlyOneTradePerBar = false;
sc.MaximumPositionAllowed = 10;

and i use folowing code for entry:




uint32_t SetOrder(SCStudyInterfaceRef& sc, Struct_Entry& Entry, Struct_SL& SL, Struct_TP& TP)
{
    
    s_SCNewOrder NewOrder;
    NewOrder.InternalOrderID = -1;


    SCString   sModul = "SetOrder";
    SCString   LM = "";


    //schon mal das Allgemeine
    NewOrder.OrderType = Entry.OrderType;
    NewOrder.TextTag = Entry.Info;
    NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED;
    NewOrder.Price1 = sc.RoundToTickSize(Entry.Point);
    NewOrder.OrderQuantity = Entry.Size;

    //--------------------------------------------------------------------------
    //Bugfix - manchmal kommt da eine Exception in sc-suorce bei Replay wegen Empty Symbol...
    NewOrder.Symbol = sc.Symbol;
    NewOrder.TradeAccount = sc.SelectedTradeAccount;
    //--------------------------------------------------------------------------
    
    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    //ATT-Order bestücken...
    if (true)
    {

      if (SL.Mode != SLTP_AUS)
      {
        if (SL.Point != 0)
        {
          NewOrder.OCOGroup1Quantity = Entry.Size;
          NewOrder.AttachedOrderStop1Type = SCT_ORDERTYPE_STOP;
          NewOrder.Stop1Price = sc.RoundToTickSize(SL.Point);
        }
      }

      if (TP.Mode != SLTP_AUS)

      {
        if (TP.Point != 0)
        {
          NewOrder.Target1Price = sc.RoundToTickSize(TP.Point);
        }
      }

    }

    /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
    //Order absenden

    t_OrderQuantity32_64 Result = 0;

    if (Entry.Direction > 0)//Buy
      Result = sc.BuyOrder(NewOrder);
    else
      Result = sc.SellOrder(NewOrder);

    if (GLOBAL_LoggingLevel > 0 || true)
    {
      SCString BeginDateTimeString;
      BeginDateTimeString = sc.FormatDateTime(sc.BaseDateTimeIn[sc.Index]);

      LM = "ATT-Orger gesetzt...";
      LM.Format("%s: %s", sModul.GetChars(), LM.GetChars());
      LM.Format("%s: Entry:[%.4f], Size:[%i] - TP1[%.4f] - SL1[%.4f] --- @:[%s]"
        , LM.GetChars()
        , NewOrder.Price1
        , NewOrder.OrderQuantity
        , NewOrder.Target1Price
        , NewOrder.Stop1Price
        , BeginDateTimeString.GetChars()
      );

      sc.AddMessageToLog(LM, 0);
    }

    if (Result > 0) //Order erfolgreich abgesetzt...
    {

      //Returnwerte
      Entry.EntryBar = sc.Index;
      Entry.OrderID = NewOrder.InternalOrderID;
      SL.OrderID = NewOrder.Stop1InternalOrderID;
      TP.OrderID = NewOrder.Target1InternalOrderID;


      SCString OR = "";
      if (Entry.Direction > 0)//Buy
        OR = "Long";
      else
        OR = "Short";

      SCString BeginDateTimeString;
      BeginDateTimeString = sc.FormatDateTime(sc.BaseDateTimeIn[sc.Index]);

      SCString LM = "";
      SCString OT = EnumOrderTypes(NewOrder.OrderType, true);
      LM.Format("NO1 - Order %s %s Ausgefuert Size[%i] ID:[%i] --- @:[%s]"
        , OR.GetChars(), OT.GetChars()
        , (int)NewOrder.OrderQuantity, (int)NewOrder.InternalOrderID
        , BeginDateTimeString.GetChars());


      sc.AddMessageToLog(LM, 0);
      sc.AddMessageToTradeServiceLog(LM, false, true);

      return NewOrder.InternalOrderID;
    }
    else //etwas schief gelaufen....
    {

      SCString LM;
      LM.Format("%s: - ERROR [%s]", sModul.GetChars(), sc.GetTradingErrorTextMessage(static_cast <int>(Result)));
      sc.AddMessageToLog(LM, 0);
      sc.AddMessageToTradeServiceLog(LM, false, true);
      return 0;
    }



  return 0; //hier sollten wir nie landen...
}


imageScreenshot_4.jpg / V - Attached On 2019-08-23 02:34:24 UTC - Size: 251.66 KB - 298 views
imageScreenshot_5.jpg / V - Attached On 2019-08-23 02:35:27 UTC - Size: 174 KB - 288 views
[2019-08-30 12:49:22]
User681685 - Posts: 12
hallo Support....Please answer. is that what you wanted and therefore my problem? or is that a bug? My Version is 1980, but in other version is the same Problem. And I can not find any mistakes on my code.I have already tried a lot and can not continue. I make a new order one or two Ticks below/above, i dont want to modyfy the first one.

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

Login

Login Page - Create Account