Support Board
Date/Time: Sun, 24 Nov 2024 16:28:31 +0000
Post From: Stop Order Not Working in ASCIL
[2024-05-21 15:34:59] |
PS - Posts: 40 |
Thank you for your reply. To be clear, below is the full entry / stop logic I've written. This logic is for a sell entry + buy stop. It sits within an if block that checks for the conditions for trade entry. I've checked the Trade Orders Window, and it is empty. No orders of any kind. Do you see a problem with this logic below? Thank you again in advance for your help. SCString logMessage; logMessage.Format("Sell conditions met: Start Price: %f, End Price: %f, Close Price: %f, Time: %s", zone.start_price, zone.end_price, close, sc.FormatDateTime(sc.BaseDateTimeIn[sc.Index]).GetChars()); sc.AddMessageToLog(logMessage, 0); s_SCNewOrder NewOrder; NewOrder.OrderQuantity = trade_quantity; NewOrder.OrderType = SCT_ORDERTYPE_MARKET; NewOrder.TimeInForce = SCT_TIF_DAY; int Result = sc.SellEntry(NewOrder); // Draw a red arrow for sell entry s_UseTool SellArrow; SellArrow.Clear(); SellArrow.ChartNumber = sc.ChartNumber; SellArrow.DrawingType = DRAWING_MARKER; SellArrow.MarkerType = MARKER_ARROWDOWN; SellArrow.MarkerSize = 8; SellArrow.Color = RGB(255, 0, 0); // Red color SellArrow.BeginIndex = sc.Index; SellArrow.BeginValue = close; sc.UseTool(SellArrow); // Place stop order 2 points above end price s_SCNewOrder StopOrder; StopOrder.OrderQuantity = trade_quantity; StopOrder.OrderType = SCT_ORDERTYPE_STOP; StopOrder.Price1 = zone.end_price + 2; StopOrder.TimeInForce = SCT_TIF_GTC; int StopResult = sc.SellEntry(StopOrder); SCString logMessagestop; logMessagestop.Format("Stop order placed at %f", StopOrder.Price1); sc.AddMessageToLog(logMessagestop, 0); |