Support Board
Date/Time: Sat, 23 Nov 2024 01:48:54 +0000
[Programming Help] - ASCIL Trailing Stops Question
View Count: 121
[2024-09-13 13:18:35] |
User371315 - Posts: 10 |
I'm trying to figure out the best way to approach this in ASCIL. Use Case: I have a trailing stopoffset of 8 points and when the contract profit reaches $500.0, I want the stopoffset to be 4 points. Whats the best way to handle it? Should I use triggered trailing step stop loss? Or write something myself to just update the stopoffset of the current stop order? |
[2024-09-17 00:57:38] |
ForgivingComputers.com - Posts: 960 |
int MoveStop(SCStudyInterfaceRef sc, const int OrderID, const double SetStopPrice)
{ // Look Up Stop Order to see if Open EXIT if not result = -1 s_SCTradeOrder TradeOrder; sc.GetOrderByOrderID(OrderID, TradeOrder); if (TradeOrder.OrderStatusCode != SCT_OSC_OPEN) { return -1; } // Look Up Previous Stop Price double PrevStop = TradeOrder.Price1; double NewStop = sc.RoundToTickSize(SetStopPrice, sc.TickSize); int result = 0; // Compare To SetStopPrice if Equal Result = 0 if (PrevStop == NewStop) { return 0; } // // Create ModifyOrder s_SCNewOrder ModifyOrder; ModifyOrder.InternalOrderID = OrderID; ModifyOrder.Price1 = NewStop; result = sc.ModifyOrder(ModifyOrder); return result; } |
To post a message in this thread, you need to log in with your Sierra Chart account: