Login Page - Create Account

Support Board


Date/Time: Thu, 08 May 2025 23:33:46 +0000



[Programming Help] - Every order is getting rejected

View Count: 161

[2024-10-29 17:46:54]
User944318 - Posts: 2
I am new to coding in Sierra charts and have the following code as a part of my study:
s_SCNewOrder NewSellOrder;
NewSellOrder.OrderType = SCT_ORDERTPE_LIMIT;
NewSellOrder.PRICE1 = sc.Ask+2;
NewSellOrder.OrderQuantity = 1;
NewSellOrder.TimeInForce = SCT_TIF_GTC;
NewSellOrder.Target1Offset = 5;
NewSellOrder.Stop1Offset = 5;
int Result = sc.SellOrder(NewSellOrder);

if (Result < 0) {sc.AddMessageToLog("Order failed", 1);}

I am just trying to submit a limit order above after each bar forms. My log keeps showing the message "Order failed", why might this be? The strategy built just fine and is able to "run" it just doesn't submit the orders.
[2024-10-30 19:18:54]
ForgivingComputers.com - Posts: 1055
Did you check the Trade Service Log?

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

Login

Login Page - Create Account