Support Board
Date/Time: Fri, 31 Jan 2025 14:47:19 +0000
Post From: Stop Loss and Profit Target lines disappear without price reaching them
[2019-05-03 21:51:35] |
Blue Brazilian - Posts: 42 |
In my automated trading study, when a trade setup is identified at the close of a bar, I create (in the case of a short trade) a sell limit order at the closing price of the signal bar and a sell stop order at a price 1 tick below the close of the signal bar. A profit target and a stop loss are set on each of these orders, together with a move of the stop loss to break even after a move of several ticks in the direction of the trade. In most cases, this works correctly. Lines are displayed on the chart at the profit target and stop loss levels for each order, and trades exit when price reaches either the profit target or the stop loss. However, in a few cases, where both the limit and stop orders have been filled, and price has not yet touched the stop loss, profit target, or break even level, the lines for profit targets and stop losses disappear, but the position quantity remains at -2, and the trade never exits, even when price subsequently hits either the original stop loss or profit target. The only clue I have is that when the orders are filled for the sell entry, the position quantity is set to -2 and the PositionData.WorkingOrdersExist is set to 1, with the PositionData.PositionQuantityWithAllWorkingOrders shown as 0, so I assume the working order is for the stop loss and/or profit target. When the lines disappear, the PositionData.WorkingOrdersExist is set to 0 with the PositionData.PositionQuantityWithAllWorkingOrders shown as -2. However, the LastFillDate still points to the original sell entry, and the LastExitDate still refers to the preceding trade, so it would appear that no order has been processed during the removal of the stop loss and profit target. I would appreciate any guidance on what type of situation might cause these events, or what else I can check that might indicate where the problem lies. Date Time Of Last Edit: 2019-05-03 21:53:51
|