Support Board
Date/Time: Tue, 26 Nov 2024 04:44:33 +0000
Post From: [ACSIL] - Trailing order does not close
[2024-01-08 23:05:15] |
backinblack - Posts: 35 |
Hi, I have a custom study that opens new positions with a trailing SL. The code looks like: NewOrder.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT; NewOrder.StopAllOffset = stopAllOffset; // Initial stop placement NewOrder.AttachedOrderStopAllType = SCT_ORDERTYPE_TRAILING_STOP; NewOrder.TriggeredTrailStopTriggerPriceOffset = priceMoveX * sc.TickSize; // When price moves 8 ticks above current stop ... NewOrder.TriggeredTrailStopTrailPriceOffset = slMoveForX * sc.TickSize; // ... increase stop by 4 ticks It runs all fine in Sim mode. But when I connect to Rithmic paper trading feed, more often than not, even though the position is closed when the target is hit, I see an orphan hanging trailing loss line on my chart which goes away if I manually press cancel. The issue is if I don't cancel the orphaned order, the system (For the right reasons), thinks that there is an open order and does no take any new positions subsequently (probably sc.MaximumPositionAllowed stops it from doing so). Is there something I am missing in my order configuration in the code here or is this a Rithmic issue? Thanks you! J |