Login Page - Create Account

Support Board


Date/Time: Thu, 06 Mar 2025 04:30:27 +0000



Post From: Issue in Execution of code in Production mode

[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 ?