I have faced the following problem when using multiple profit targets set via "Exit" methods ("ExitShortMIT" in particular) for a short trade that was filled in two stages:
1. A short trade on ES futures with 20 lot size was opened in two parts - first part is 4 lots, the second part - 16 lots
2. Once the entry order is filled (has state "Filled" in OnExecution method) - the strategy has set a stop loss and several profit targets (using ExitShortStop and ExitShortMIT methods): 1st = 10 lots, 2nd = 2 lots, 3rd = 2 lots and so on till 6th = 2 lots
3. Once 1st profit target with 10 lots was filled, the strategy has cancelled the stop loss and all other profit targets leaving 10 lots from the original position without a stop loss and profit target
Can you please advise me on how I can set multiple profit targets so that they are not cancelled in case of the initial position is filled in several stages?
Attached is the screenshot of the problem.
And below is the related log data:
Opening the short position:
Order (orderId='87156e96e62d40ad9c0b5a08ec3c6760' account='Playback101' name='Short' orderState=PartFilled instrument='ES 09-19' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=20 tif=Gtc oco='' filled=4 averageFillPrice=2917.5 onBehalfOf='' id=1375 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02') update: PartFilled
Order (orderId='87156e96e62d40ad9c0b5a08ec3c6760' account='Playback101' name='Short' orderState=Filled instrument='ES 09-19' orderAction=SellShort orderType='Market' limitPrice=0 stopPrice=0 quantity=20 tif=Gtc oco='' filled=20 averageFillPrice=2917.3 onBehalfOf='' id=1375 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02') update: Filled
Setting Exit orders (1 SL and 6 TP):
Entered internal SubmitOrderManaged() method at 02.09.2019 15:30:01: BarsInProgress=0 Action=BuyToCover OrderType=StopMarket Quantity=20 LimitPrice=0 StopPrice=2919.25 SignalName='Short#SL' FromEntrySignal='Short'
Order (orderId='2a145b237cfb419fa9f5fa62877394cb' account='Playback101' name='Short#SL' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=2919.25 quantity=20 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1376 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02') update: Accepted
Entered internal SubmitOrderManaged() method at 02.09.2019 15:30:01: BarsInProgress=0 Action=BuyToCover OrderType=MIT Quantity=10 LimitPrice=0 StopPrice=2916.00 SignalName='Short#TP1' FromEntrySignal='Short'
Order (orderId='b1821b253a3d46148ea2bd69c4c530f2' account='Playback101' name='Short#TP1' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2916 quantity=10 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1377 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02') update: Accepted
Entered internal SubmitOrderManaged() method at 02.09.2019 15:30:01: BarsInProgress=0 Action=BuyToCover OrderType=MIT Quantity=2 LimitPrice=0 StopPrice=2915.25 SignalName='Short#TP2' FromEntrySignal='Short'
Order (orderId='4b47137d7c5841b9b70381b26665006f' account='Playback101' name='Short#TP2' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2915.25 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1378 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02') update: Accepted
Entered internal SubmitOrderManaged() method at 02.09.2019 15:30:01: BarsInProgress=0 Action=BuyToCover OrderType=MIT Quantity=2 LimitPrice=0 StopPrice=2914.75 SignalName='Short#TP3' FromEntrySignal='Short'
Order (orderId='520b395597c34ea8a529c3705e8650d3' account='Playback101' name='Short#TP3' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2914.75 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1379 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02') update: Accepted
Entered internal SubmitOrderManaged() method at 02.09.2019 15:30:01: BarsInProgress=0 Action=BuyToCover OrderType=MIT Quantity=2 LimitPrice=0 StopPrice=2914.00 SignalName='Short#TP4' FromEntrySignal='Short'
Order (orderId='a598533675e44bb2bf00e835344405b2' account='Playback101' name='Short#TP4' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2914 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1380 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02') update: Accepted
Entered internal SubmitOrderManaged() method at 02.09.2019 15:30:01: BarsInProgress=0 Action=BuyToCover OrderType=MIT Quantity=2 LimitPrice=0 StopPrice=2913.25 SignalName='Short#TP5' FromEntrySignal='Short'
Order (orderId='7d81350207db4cd295fb818c5c38ff5d' account='Playback101' name='Short#TP5' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2913.25 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1381 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02') update: Accepted
Entered internal SubmitOrderManaged() method at 02.09.2019 15:30:01: BarsInProgress=0 Action=BuyToCover OrderType=MIT Quantity=2 LimitPrice=0 StopPrice=2912.75 SignalName='Short#TP6' FromEntrySignal='Short'
Order (orderId='db289dfb7c714723bb2746b2c3d4176f' account='Playback101' name='Short#TP6' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2912.75 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1382 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02') update: Accepted
TP1 is filled:
Order (orderId='b1821b253a3d46148ea2bd69c4c530f2' account='Playback101' name='Short#TP1' orderState=Filled instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2916 quantity=10 tif=Gtc oco='' filled=10 averageFillPrice=2916.25 onBehalfOf='' id=1377 time='2019-09-02 16:17:49' gtd='2099-12-01' statementDate='2019-09-02') update: Filled
Stop loss and other profit targets are cancelled:
Cancelled pending exit order, since associated position is closed, orderId='db289dfb7c714723bb2746b2c3d4176f' account='Playback101' name='Short#TP6' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2912.75 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1382 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02'
Cancelled pending exit order, since associated position is closed, orderId='7d81350207db4cd295fb818c5c38ff5d' account='Playback101' name='Short#TP5' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2913.25 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1381 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02'
Cancelled pending exit order, since associated position is closed, orderId='a598533675e44bb2bf00e835344405b2' account='Playback101' name='Short#TP4' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2914 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1380 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02'
Cancelled pending exit order, since associated position is closed, orderId='520b395597c34ea8a529c3705e8650d3' account='Playback101' name='Short#TP3' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2914.75 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1379 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02'
Cancelled pending exit order, since associated position is closed, orderId='4b47137d7c5841b9b70381b26665006f' account='Playback101' name='Short#TP2' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='MIT' limitPrice=0 stopPrice=2915.25 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1378 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02'
Cancelled pending exit order, since associated position is closed, orderId='2a145b237cfb419fa9f5fa62877394cb' account='Playback101' name='Short#SL' orderState=Accepted instrument='ES 09-19' orderAction=BuyToCover orderType='Stop Market' limitPrice=0 stopPrice=2919.25 quantity=20 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1376 time='2019-09-02 15:30:01' gtd='2099-12-01' statementDate='2019-09-02'
Best regards,
Alexei
Comment