Login Page - Create Account

Support Board


Date/Time: Wed, 05 Mar 2025 19:27:29 +0000



[Programming Help] - Issue in Execution of code in Production mode

View Count: 751

[2022-01-19 19:21:44]
User764244 - Posts: 15
I have created a script that send message to discord server when there is trade happening it works in live trading but when i run in Production mode it does not work at all not even log is displayed


int Index = 0;
s_SCTradeOrder OrderDetails;
while( sc.GetOrderByIndex (Index, OrderDetails) != SCTRADING_ORDER_ERROR)
{
  Index++;
  int InternalOrderID = OrderDetails.InternalOrderID;

  log.Format("The InternalOrderID is %d the status is %d",InternalOrderID,OrderDetails.BuySell);
  sc.AddMessageToLog(log,1);
  if(Status == SCT_OSC_FILLED && (setptr->find(InternalOrderID) == setptr->end()) )
  {
    string text;
    if(BuySell == BSE_BUY)
    {
      if(OrderDetails.OrderTypeAsInt == SCT_ORDERTYPE_MARKET)
        text = "New Position Buy "+ to_string(Qty) + "x "+ChartName + " @Price "+to_string(Price);
}
    else if(BuySell == BSE_SELL)
    {
      if(OrderDetails.OrderTypeAsInt == SCT_ORDERTYPE_MARKET)
        text = "New Position Sell "+ to_string(Qty) + "x "+ChartName + " @Price " + to_string(Price);
}
    string text2 = "Daily Profit/Loss is "+to_string(PositionData.DailyProfitLoss);

    SendMessageToDiscord(command,text2,profit_weblink); // sending message to Profit channel
}

// Default = "python3 scriptname.py "
// link is the link to the discord server
void SendMessageToDiscord(string Default , string text, string link)
{
  string Command = Default + "\""+text+"\"" + " \""+link+"\"";
  system(Command.c_str());
}


any idea how to fix this ?
[2022-01-19 20:05:36]
Sierra Chart Engineering - Posts: 104368
It probably relates to this variable setting:
Automated Trading Management: SendOrdersToTradeService
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
[2022-01-20 05:04:58]
User764244 - Posts: 15
It is on 2 different instances there are 1 sc working live and other sc instance working in simulation mode
[2022-01-21 00:05:51]
Sierra Chart Engineering - Posts: 104368
When using this function:
sc.GetOrderByIndex

Are you wanting to get simulated or non-simulated orders?
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
[2022-01-21 05:47:38]
User764244 - Posts: 15
Non simulated orders
[2022-01-22 16:08:31]
User764244 - Posts: 15
Is there is different method used in Live trade ?

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

Login

Login Page - Create Account