Login Page - Create Account

Support Board


Date/Time: Mon, 06 May 2024 14:10:47 +0000



ACSIL - Chart Replay and submitting order for another symbol (Market Order never Fills)

View Count: 1223

[2016-09-09 08:42:49]
William O - Posts: 16
I have a study that submits a market order for another symbol during a chart replay. The market order is successfully submitted using sc.SellOrder. However, this order never fills. I can pull up the Trade Orders and Positions window and see that the order was submitted as a market order and that it is open but not filled.

For example, if I run the study code provided below in an ESZ16 chart replay I get this problem. I'm running this study on the ESZ16 chart and submitting a sell order for the NQZ16 symbol.

Please let me know if I'm doing something wrong or how to fix this problem. Thanks for your support!


SCSFExport scsf_TradingOnAnotherChart(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the study configuration and defaults.
    sc.GraphName = "Chart Replay: Trading Another Chart";
    sc.StudyDescription = "";

    sc.SendOrdersToTradeService = false;
    sc.AllowOnlyOneTradePerBar = false;

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

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

    sc.FreeDLL = 0;
    return;
  }

  const char * OtherSymbol = "NQZ16";
  const char * TradeAccount = "Sim1";

  s_SCPositionData OtherPositionData;
  int returnval = sc.GetTradePositionForSymbolAndAccount(OtherPositionData, OtherSymbol, TradeAccount);

  if (!sc.IsFullRecalculation && sc.IsReplayRunning() && OtherPositionData.PositionQuantity == 0 && !OtherPositionData.WorkingOrdersExist)
  {
    int quantity = 1;
    s_SCNewOrder o;
    o.OrderQuantity = quantity;
    o.OrderType = SCT_MARKET;
    o.Symbol = OtherSymbol;
    o.TimeInForce = SCT_TIF_DAY;
    o.TradeAccount = TradeAccount;
    
    int result = sc.SellOrder(o);
    if (result <= 0)//order was not accepted
    {
      sc.AddMessageToLog(sc.GetTradingErrorTextMessage(result), 0);
    }
  }
}


[2016-09-09 17:54:33]
Sierra Chart Engineering - Posts: 104368
Is Sierra Chart connected to the data feed and receiving streaming data for NQZ16? This is a requirement. Otherwise, the order will not fill. We have added this section to the documentation to explain this:
http://www.sierrachart.com/index.php?page=doc/ACSILTrading.html#DataFeedConnectionAndStreamingDataRequired

There is no other solution. This is absolutely required.
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