Login Page - Create Account

Support Board


Date/Time: Wed, 21 Aug 2019 09:02:57 +0000



ACSIL howto get working OrderID/FilledPrice in ReplayMode (Sim)

Support Request:
[2018-12-09 17:29:34]
TedMar - Posts: 126
Hi, im not understand how i can get OrderID and FilledPrice from manual placed Order in Replay mode.

1.) i tryit like this manual https://www.sierrachart.com/index.php?page=doc/ACSILTrading.html#GetOrderByIndex to get Open OrderID

But i get still InternalOrderID == 173365328

2.) Im not sure , but is OrderID needed o get AvgFillPrice from s_SCTradeOrder Structure Members? https://www.sierrachart.com/index.php?page=doc/ACSILTrading.html#s_SCTradeOrder_AvgFillPrice

3.) sc.GetOrderFillEntry(0,FillPrice) together with sc.GetOrderFillArraySize() result is 0
[2018-12-14 17:38:19]
Sierra Chart Engineering - Posts: 75330
1. Looks like you are checking the Service Order ID member instead or somehow not interpreting it properly.

2. Yes.

3. We will see if we can put together an example for this.
Sierra Chart Support - Engineering Level

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

If your question/request has been answered and you do not have anything further, then it is easiest for us if you do not reply again to say thank you.
Date Time Of Last Edit: 2018-12-14 17:38:44
[2018-12-17 05:30:34]
Sierra Chart Engineering - Posts: 75330
3. Here is the code example:

SCSFExport scsf_GetOrderFillEntryExample(SCStudyInterfaceRef sc)
{
  //Define references to the Subgraphs and Inputs for easy reference.
  //In this particular example, these are not used but this study is configured as a typical trading study.
  SCSubgraphRef BuyEntrySubgraph = sc.Subgraph[0];
  SCSubgraphRef BuyExitSubgraph = sc.Subgraph[1];
  SCSubgraphRef SellEntrySubgraph = sc.Subgraph[2];
  SCSubgraphRef SellExitSubgraph = sc.Subgraph[3];

  SCInputRef Enabled = sc.Input[0];

  if (sc.SetDefaults)
  {
    // Set the study configuration and defaults.

    sc.GraphName = "GetOrderFillEntry Example";

    BuyEntrySubgraph.Name = "Buy Entry";
    BuyEntrySubgraph.DrawStyle = DRAWSTYLE_ARROW_UP;
    BuyEntrySubgraph.PrimaryColor = RGB(0, 255, 0);
    BuyEntrySubgraph.LineWidth = 2;
    BuyEntrySubgraph.DrawZeros = false;

    BuyExitSubgraph.Name = "Buy Exit";
    BuyExitSubgraph.DrawStyle = DRAWSTYLE_ARROW_DOWN;
    BuyExitSubgraph.PrimaryColor = RGB(255, 128, 128);
    BuyExitSubgraph.LineWidth = 2;
    BuyExitSubgraph.DrawZeros = false;

    SellEntrySubgraph.Name = "Sell Entry";
    SellEntrySubgraph.DrawStyle = DRAWSTYLE_ARROW_DOWN;
    SellEntrySubgraph.PrimaryColor = RGB(255, 0, 0);
    SellEntrySubgraph.LineWidth = 2;
    SellEntrySubgraph.DrawZeros = false;

    SellExitSubgraph.Name = "Sell Exit";
    SellExitSubgraph.DrawStyle = DRAWSTYLE_ARROW_UP;
    SellExitSubgraph.PrimaryColor = RGB(128, 255, 128);
    SellExitSubgraph.LineWidth = 2;
    SellExitSubgraph.DrawZeros = false;

    Enabled.Name = "Enabled";
    Enabled.SetYesNo(0);
    Enabled.SetDescription("This input enables the study and allows it to function. Otherwise, it does nothing.");

    // This is false by default. Orders will be simulated.
    sc.SendOrdersToTradeService = false;

    sc.AllowMultipleEntriesInSameDirection = false;

    //This must be equal to or greater than the order quantities you will be submitting orders for.
    sc.MaximumPositionAllowed = 10000;

    sc.SupportReversals = true;
    sc.AllowOppositeEntryWithOpposingPositionOrOrders = true;

    // This variable controls whether to use or not use attached orders that are configured on the Trade Window for the chart.
    sc.SupportAttachedOrdersForTrading = false;

    //This variable controls whether to use the "Use Attached Orders" setting on the Trade Window for the chart
    sc.UseGUIAttachedOrderSetting = false;

    sc.CancelAllOrdersOnEntriesAndReversals = false;
    sc.AllowEntryWithWorkingOrders = false;
    sc.CancelAllWorkingOrdersOnExit = true;
    sc.AllowOnlyOneTradePerBar = false;

    //This needs to be set to true when a trading study uses trading functions.
    sc.MaintainTradeStatisticsAndTradesData = true;

    sc.AutoLoop = true;
    sc.GraphRegion = 0;

    return;
  }

  //These must be outside of the sc.SetDefaults code block since they have a dependency upon an actual chart object existing
  sc.SupportTradingScaleIn = 0;
  sc.SupportTradingScaleOut = 0;


  if (!Enabled.GetYesNo())
    return;

  if (sc.LastCallToFunction)
    return;//nothing to do

  int& PriorOrderFillEntrySize = sc.GetPersistentInt(1);

  int CurrentOrderFillEntrySize = sc.GetOrderFillArraySize();

  if (CurrentOrderFillEntrySize != PriorOrderFillEntrySize)
  {
    PriorOrderFillEntrySize = CurrentOrderFillEntrySize;
    if (CurrentOrderFillEntrySize > 0)
    {
      s_SCOrderFillData OrderFillData;

      sc.GetOrderFillEntry(CurrentOrderFillEntrySize - 1, OrderFillData);
      SCString OrderFillMessage;

      uint32_t OrderQuantity = OrderFillData.Quantity;

      OrderFillMessage.Format("New order fill: InternalOrderID = %u, FillPrice = %f, Quantity = %u", OrderFillData.InternalOrderID, OrderFillData.FillPrice, OrderQuantity);

      sc.AddMessageToLog(OrderFillMessage, 0);

    }

  }
}

Sierra Chart Support - Engineering Level

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

If your question/request has been answered and you do not have anything further, then it is easiest for us if you do not reply again to say thank you.
[2019-01-21 02:22:46]
TedMar - Posts: 126
Is posible to get in similery way "OrderFillData.InternalOrderID, OrderFillData.FillPrice, OrderQuantity" from other Chart/Symbol in replay mode?
[2019-05-15 18:03:20]
TedMar - Posts: 126
I have no idea how i get open orderes and status for other Symbol used sc.GetOrderFillArraySize. Without OrderID i do no see way to manage orders in Other Symbol like u manual https://www.sierrachart.com/index.php?page=doc/ACSILTrading.html#SubmittingOrdersDifferentSymbolAccount

With this Code i pull most infos from s_SCPositionData structure, but not ordersIDs.

s_SCPositionData PositionData;
sc.GetTradePositionForSymbolAndAccount(PositionData, "F.US.YMM19", sc.SelectedTradeAccount);

Is posible to get open OrdersIDs for other Symbols (without Chart)?
Date Time Of Last Edit: 2019-05-15 20:44:57

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

Login

Login Page - Create Account