Support Board
Date/Time: Fri, 24 Apr 2026 05:51:40 +0000
Study has issue with submitting orders
View Count: 14
| [2026-04-24 01:07:35] |
| User944318 - Posts: 53 |
|
When I run this study, it correctly enters and exit the first trade of the day as expected, however, any subsequent trades, whether I am reversing position at the exit of the first one or entering a new trade an hour later are ignored (no trade is sent to my broker). Additionally, when I am running a nearly identical study on another chart of the same instrument, its trades are blocked by the trading of this study. For example: I had this and a similar study running on two different ES charts at the same time. They were both supposed to go long at 9:45, exit that position and go short at 10 and exit the short at 10:15. The first study correctly entered at 9:45 and exited at 10, but did not take it's second trade. The second study's trades were not submitted for either trade. I received the success message from both studies for both 9:45 and 10 as expected but the trades were not submitted (it seems like the studies are interpretting the data as expected, but orders are being block), what is going on? s_SCPositionData PositionData; sc.GetTradePosition(PositionData); int position = PositionData.PositionQuantity; if (position < 0) { s_SCNewOrder exitOrder; exitOrder.OrderQuantity = -1*position; // 1 contract or whatever is long exitOrder.OrderType = SCT_ORDERTYPE_MARKET; exitOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; int result = sc.SellExit(exitOrder); } else if (position > 0) { s_SCNewOrder exitOrder; exitOrder.OrderQuantity = position; // 1 contract or whatever is long exitOrder.OrderType = SCT_ORDERTYPE_MARKET; exitOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; int result = sc.BuyExit(exitOrder); } if (CurrentHour < 9 || CurrentHour > 10 || (CurrentHour == 9 && CurrentMinute < 28) || (CurrentHour == 10 && CurrentMinute > 16)) { return; } if (condition1) { s_SCNewOrder NewOrder; NewOrder.OrderQuantity = 1; NewOrder.OrderType = SCT_ORDERTYPE_MARKET; NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; int resultS = sc.SellEntry(NewOrder); if (resultS == 0) { if (sc.Index == sc.ArraySize -1) { //Add error message to the Sierra Chart Message Log for interpretation sc.AddMessageToLog(sc.GetTradingErrorTextMessage(resultS), 0); sc.AddMessageToLog("FAILURE", 1); } } else { sc.AddMessageToLog("SUCCESS: Sell Entry Order Submitted!", 1); } } if (condition2) { s_SCNewOrder NewOrder; NewOrder.OrderQuantity = 1; NewOrder.OrderType = SCT_ORDERTYPE_MARKET; NewOrder.TimeInForce = SCT_TIF_GOOD_TILL_CANCELED; int resultB = sc.BuyEntry(NewOrder); if (resultB == 0) { if (sc.Index == sc.ArraySize -1) { //Add error message to the Sierra Chart Message Log for interpretation sc.AddMessageToLog(sc.GetTradingErrorTextMessage(resultB), 0); sc.AddMessageToLog("FAILURE", 1); } } else { sc.AddMessageToLog("SUCCESS: Sell Entry Order Submitted!", 1); } } |
To post a message in this thread, you need to log in with your Sierra Chart account:
