Support Board
Date/Time: Sun, 24 Nov 2024 05:45:36 +0000
[Programming Help] - Help finding the nearest stop order id for move to break even button
View Count: 170
[2024-06-19 04:41:56] |
TriStar Trading - Posts: 142 |
Hey all you wizards out there. I'm attempting to program a button to move a stop order to break even. Just like the one on the Trade Window. Need it floating and bigger on a toolbar. Does anyone know how to find the nearest stop order internal id if it is not an attached order? Also, if it is an attached stop order, would the code need to be different to move it to break even. Here is what I have so far. Thanks in advance! Mike if (sc.MenuEventID == Input_ACSButtonNumber.GetInt()) { if (PositionData.PositionQuantity < 0 && //Short Position sc.Close[sc.Index] < PositionData.AveragePrice) //Current price less than position price { //Stop to BE s_SCTradeOrder ExistingStopOrder; int OrderID = sc.GetNearestStopOrder(ExistingStopOrder); s_SCNewOrder ModifyOrder; ModifyOrder.InternalOrderID = OrderID; float NewStopPrice = PositionData.AveragePrice; ModifyOrder.Price1 = NewStopPrice; } } |
To post a message in this thread, you need to log in with your Sierra Chart account: