We send orders using SubmitOrderUnmanaged() and implemented trailing stop using chargeOrder().
Noticed that some of the stop/loss orders don't get triggered.
Are there rules about when a stop/loss order will get triggered or not?
Thanks.
Here's a sample log showing when stop order is changed (using TraceOrders and OnOrderTrace) and current price via OnMarketData.
Dates below are in GMT+8.
Stop price gets updated to 11509.5 near 27/05/2020 00:39:23.537000.
Price goes down to 11509, 11508.5,11508 on 27/05/2020 00:42:30.139000.
Stop/loss gets triggered later on 27/05/2020 00:47:59.991000.
27/05/2020 00:39:22.439000 marketDataUpdate.Price: 11514.5 Market position is Long Auto Trail Frequency Threshold is 11514.5 Threshold is reached? YES Current Trail Stop is 11509.5 Changing stop order quantity from 11509 to 11509.5 with price at 11514.5 27/05/2020 12:39:00 AM Strategy 'BackTesting Strategy/-1': Changed custom managed order: orderId='NT-00478-1224' account='Backtest' name='Stop1/Trade Strategy 6.2.1.3.1.8-a' orderState=Working instrument='FDAX 12-20' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=11509 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=-1 time='2020-05-27 00:23:00' gtd='2099-12-01' statementDate='2020-12-03' limitPriceChanged=0 quantityChanged=1 stopPriceChanged=11509.5 The order name Stop1/Trade Strategy 6.2.1.3.1.8-a stop price is currently 11509.5 The order name Stop1/Trade Strategy 6.2.1.3.1.8-a stop price is currently 11509.5 The order name Stop1/Trade Strategy 6.2.1.3.1.8-a stop price is currently 11509.5 The order name Stop1/Trade Strategy 6.2.1.3.1.8-a stop price is currently 11509.5 27/05/2020 00:39:23.537000 marketDataUpdate.Price: 11514 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:39:23.552000 marketDataUpdate.Price: 11514.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:39:28.133000 marketDataUpdate.Price: 11514 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:39:30.204000 marketDataUpdate.Price: 11514 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:39:34.063000 marketDataUpdate.Price: 11513.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:39:37.824000 marketDataUpdate.Price: 11514 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:39:48.356000 marketDataUpdate.Price: 11513.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:39:51.523000 marketDataUpdate.Price: 11514.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO [SNIP] Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:16.973000 marketDataUpdate.Price: 11511 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:21.059000 marketDataUpdate.Price: 11512 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:26.531000 marketDataUpdate.Price: 11511.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:28.008000 marketDataUpdate.Price: 11511 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:29.720000 marketDataUpdate.Price: 11511 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:30.011000 marketDataUpdate.Price: 11510.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:30.110000 marketDataUpdate.Price: 11510 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:30.138000 marketDataUpdate.Price: 11509.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:30.138000 marketDataUpdate.Price: 11509.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:30.139000 marketDataUpdate.Price: 11509 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:30.139000 marketDataUpdate.Price: 11508.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:30.788000 marketDataUpdate.Price: 11508 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:30.789000 marketDataUpdate.Price: 11508 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:30.789000 marketDataUpdate.Price: 11508 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:30.791000 marketDataUpdate.Price: 11508.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:31.425000 marketDataUpdate.Price: 11508.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:31.426000 marketDataUpdate.Price: 11509 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:33.353000 marketDataUpdate.Price: 11510 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:42:33.353000 marketDataUpdate.Price: 11510 Market position is Long [SNIP] 27/05/2020 00:47:40.789000 marketDataUpdate.Price: 11510.5 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:47:50.199000 marketDataUpdate.Price: 11510 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:47:55.539000 marketDataUpdate.Price: 11510 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:47:55.540000 marketDataUpdate.Price: 11510 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:47:55.540000 marketDataUpdate.Price: 11510 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:47:55.540000 marketDataUpdate.Price: 11510 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO 27/05/2020 00:47:59.991000 marketDataUpdate.Price: 11508 Market position is Long Auto Trail Frequency Threshold is 11515 Threshold is reached? NO Resetting entryOrder, _InitializingStopsAndTargets, _TotalStopsSubmitted, and _TotalTriggersSubmitted. Removing strategy Trade Strategy 6.2.1.3.1.8-a from collection. No. of active users of strategy Trade Strategy 6.2.1.3.1.8-a: -1 Removing entries for Trade Strategy 6.2.1.3.1.8-a 27/05/2020 00:48:00.001000 marketDataUpdate.Price: 11508 27/05/2020 00:48:01.268000 marketDataUpdate.Price: 11508.5 27/05/2020 00:48:02.739000 marketDataUpdate.Price: 11508 27/05/2020 00:48:06.938000 marketDataUpdate.Price: 11508.5 27/05/2020 00:48:14.142000 marketDataUpdate.Price: 11508
Chart cropped shot.
(1) is latest Stop/Loss order position.
(2) is what should've triggered stop/loss.
(3) is what ended up triggering stop/loss.
Comment