Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

stopping and starting strategies with positions on

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    stopping and starting strategies with positions on

    NT cancels all orders when it starts strategies.

    I have it configured to not cancel entries or exit orders when a strategy is disabled and to "Immediately transmit live working orders".

    Presumably with these settings when I enable a strategy, it assumes that there is no position on in the market and therefore there's no requirement for exits.

    It seems there's no configuration to prevent NT from cancelling all the orders when a strategy is enabled.

    I often close down NT for some reason or another during trading and I want to leave my positions on, with the associated stop orders. I can do this, but re-enabling the strategy results in the cancellation of the stop.

    Just now for instance: a strategy has a position on, and a stop order in place. I exit NT and everything remains as it is - that's good. I don't want to close the position or have a position without a stop.

    But when I restart the strategy, it cancels the stop and doesn't replace it. This is all in the course of one hourly bar now - there's been no onBarUpdate event missed.

    I have tried using the option to 'sync' the strategy with the market, but there's some logic in NT which causes a huge order to go through to convert my GBP balance to USD - I guess the GBPUSD strategy wants a flat balance in GBP?

    So I think a third option is required where NT will re-start trading, recognising orders still active and managing them again, but not try to change the balance.

    #2
    Hi Adamus, unfortunately I could not reproduce no my end here -

    1. started strategy that placed a exit bracket consisting of stop and target 100 ticks away, set to immediately submit, synced Account up and disable strategy (with Cancel Entry / Exit order unchecked beforehand as option) > order remained working protecting position open

    2. restart NT and strategy and reenabled it on same settings, positions were of course still in sync and I saw no orders cancelled as the working historical orders needed no resubmitting.

    If you could send me your logs and traces via Help > Mail to Support I would be happy to review those to follow what happend in your testing scenario.

    Thanks

    Comment


      #3
      Bertrand,

      you missed a key part of the issue: I am not using 'sync account position'. I set it to false.

      Comment


        #4
        adamus, I wasn't using this setting either - with synching up I just meant after the first strategy start up I bought the needed position the strategy was having historically manually for my account to ensure sync between those.

        Comment


          #5
          Ah, OK. Perhaps it's the position that is causing a problem for me. With this configuration, does NT actually check what the position in the account is, or does it ignore it?

          Comment


            #6
            No, it would only check with SyncAccountPosition = true and issue a 'Syncronize' order if needed to match account position to the strategy one.

            Comment


              #7
              Hi Bertrand,
              I'll get back to you on this. I can't enable my strategies at the moment. When I've got it going again, I'll post here with more about the issue I'm talking about - assuming it's not gone away.

              Thanks

              Comment


                #8
                Sounds good adamus, thanks for your support in testing NT7.

                Comment


                  #9
                  Finally got around to looking at this issue again.

                  The issue is still the same as in my first posts.

                  This is what happens - it just happened again so it is freshly imprinted on my memory:

                  (1) had a strategy running that had a short position in the market with two OCO orders, a stop loss and a limit to exit the position.

                  (2) IB TWS shut itself down and NT obviously lost the connection, disabled the strategy and asked me to restart the app. So I closed it down.

                  (3) I restarted IB TWS, and NT, connected them, and enabled the strategy.

                  (4) immediately the 2 orders mentioned in (1) were cancelled and the strategy went into 'pending' status (yellow).

                  (5) I was left with a naked position in the market and I had to re-enter the orders by hand.

                  I'm using NT7 beta 18.

                  Thanks
                  Last edited by adamus; 07-21-2010, 04:07 PM.

                  Comment


                    #10
                    4. It is very important to understand what options you have in use. Please go to Tools>Options>Strategies>NinjaScript.

                    Do you have "Cancel exit orders when a strategy is disabled"?
                    Do you have "Immediately submit live working historical orders"?
                    The SyncAccountPosition property Bertrand asked about is important to know as well. That property is determined on your strategy properties itself.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Hi Josh,

                      "Cancel exit orders" is not checked. ("Cancel entries" is checked).

                      "Immediately submit live working historical orders" is not chosen - the other option is selected.

                      Sync Account Position is set to false.

                      Comment


                        #12
                        Do you still have your log/traces for this occurrence? Please attach them and provide us with a rough timestamp as to when it occurred. Thank you.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Sure. It happened again last night between 22:00 and 23:00.

                          Please don't get confused by any logs after the orders were cancelled. To get things back in sync, I had to disable the strategies again, close the positions (so I lost the commission on that), turn on "Immediately submit...." and "Sync account position" and then I re-enabled them.

                          I hope you guys can work out what the problem is - at the moment I only have 3 strategies running but I want to put 30 strategies live when I've stabilised my environment.
                          Attached Files
                          Last edited by adamus; 07-23-2010, 05:00 AM.

                          Comment


                            #14
                            adamus,

                            I have reviewed your log and traces and there is no indication any orders were cancelled as you restarted NT. In fact, the traces explicitly show the orders continued in a working state.

                            NT was closed and restarted at 22:32. IB connection was reestablished around 22:33. Old orders were recovered properly.

                            Code:
                            2010-07-22 22:33:18:706 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventArgs: Order='1284990863/U618350' [COLOR=Red][B]Name='External' New state=Initialized[/B][/COLOR] Instrument='$EURUSD' Action=Sell Limit price=1.3008 Stop price=0 Quantity=0.1M Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:714 (IB) Cbi.Order.Update1: oldid='1284990863' Order='1284990863/U618350' [COLOR=Red][B]Name='External' New state=Initialized[/B][/COLOR] Instrument='$EURUSD' Action=Sell Limit price=1.3008 Stop price=0 Quantity=0.1M Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:727 (IB) IB.Order.ProcessOpenOrdersNow: orderId=79
                            2010-07-22 22:33:18:743 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventArgs: Order='1284990863/U618350' [COLOR=Red][B]Name='External' New state=Working[/B][/COLOR] Instrument='$EURUSD' Action=Sell Limit price=1.3008 Stop price=0 Quantity=0.1M Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:743 (IB) Cbi.Order.Update1: oldid='1284990863' Order='1284990863/U618350' [COLOR=Red][B]Name='External' New state=Working[/B][/COLOR] Instrument='$EURUSD' Action=Sell Limit price=1.3008 Stop price=0 Quantity=0.1M Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:744 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventArgs: Order='1284990864/U618350' [COLOR=Red][B]Name='External' New state=Initialized[/B][/COLOR] Instrument='$EURUSD' Action=Sell Limit price=0 Stop price=1.2836 Quantity=0.1M Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:744 (IB) Cbi.Order.Update1: oldid='1284990864' Order='1284990864/U618350' [COLOR=Red][B]Name='External' New state=Initialized[/B][/COLOR] Instrument='$EURUSD' Action=Sell Limit price=0 Stop price=1.2836 Quantity=0.1M Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:744 (IB) IB.Order.ProcessOpenOrdersNow: orderId=80
                            2010-07-22 22:33:18:744 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventArgs: Order='1284990864/U618350' [COLOR=Red][B]Name='External' New state=Accepted[/B][/COLOR] Instrument='$EURUSD' Action=Sell Limit price=0 Stop price=1.2836 Quantity=0.1M Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:744 (IB) Cbi.Order.Update1: oldid='1284990864' Order='1284990864/U618350' [COLOR=Red][B]Name='External' New state=Accepted[/B][/COLOR] Instrument='$EURUSD' Action=Sell Limit price=0 Stop price=1.2836 Quantity=0.1M Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:745 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventArgs: Order='1284990867/U618350' [COLOR=Red][B]Name='External' New state=Initialized[/B][/COLOR] Instrument='$GBPUSD' Action=Sell Limit price=0 Stop price=1.52315 Quantity=0.1M Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:745 (IB) Cbi.Order.Update1: oldid='1284990867' Order='1284990867/U618350' [COLOR=Red][B]Name='External' New state=Initialized[/B][/COLOR] Instrument='$GBPUSD' Action=Sell Limit price=0 Stop price=1.52315 Quantity=0.1M Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:745 (IB) IB.Order.ProcessOpenOrdersNow: orderId=83
                            2010-07-22 22:33:18:745 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventArgs: Order='1284990867/U618350' [COLOR=Red][B]Name='External' New state=Accepted[/B][/COLOR] Instrument='$GBPUSD' Action=Sell Limit price=0 Stop price=1.52315 Quantity=0.1M Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:745 (IB) Cbi.Order.Update1: oldid='1284990867' Order='1284990867/U618350' [COLOR=Red][B]Name='External' New state=Accepted[/B][/COLOR] Instrument='$GBPUSD' Action=Sell Limit price=0 Stop price=1.52315 Quantity=0.1M Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:745 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventArgs: Order='1284990866/U618350' [COLOR=Red][B]Name='External' New state=Initialized[/B][/COLOR] Instrument='$GBPUSD' Action=Sell Limit price=1.53245 Stop price=0 Quantity=0.1M Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:745 (IB) Cbi.Order.Update1: oldid='1284990866' Order='1284990866/U618350' [COLOR=Red][B]Name='External' New state=Initialized [/B][/COLOR]Instrument='$GBPUSD' Action=Sell Limit price=1.53245 Stop price=0 Quantity=0.1M Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:745 (IB) IB.Order.ProcessOpenOrdersNow: orderId=82
                            2010-07-22 22:33:18:745 (IB) Cbi.Connection.ProcessEventArgs.OrderStatusEventArgs: Order='1284990866/U618350' [COLOR=Red][B]Name='External' New state=Working[/B][/COLOR] Instrument='$GBPUSD' Action=Sell Limit price=1.53245 Stop price=0 Quantity=0.1M Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
                            2010-07-22 22:33:18:745 (IB) Cbi.Order.Update1: oldid='1284990866' Order='1284990866/U618350' [COLOR=Red][B]Name='External' New state=Working[/B][/COLOR] Instrument='$GBPUSD' Action=Sell Limit price=1.53245 Stop price=0 Quantity=0.1M Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
                            These orders were not cancelled.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Hi Josh,

                              unfortunately my description in post #9 was not detailed enough to describe the sequence of events unambiguously. It is unfortunate that neither the NT logs, nor the IB TWS logs picked up any log output that helps here.

                              Closing NT wasn't what cancelled the orders. As you say, on restarting, NT picked up the presence of whatever orders were there without problem.

                              Re-enabling the strategies cancelled the orders.

                              In order to be less ambiguous and hopefully to help you diagnose the issue, I shall repeat the steps outlined in #9, with more detail.



                              (1) I had 3 strategies running, at least one of which had a position in the market with a pair of OCO orders, a stop loss and a limit to exit the position.

                              (2) IB TWS shut itself down automatically at 22:00GMT+1 and NT obviously lost the connection, disabled the strategy and asked me to restart the app. So I closed it down.

                              (3a) I restarted IB TWS
                              - I restarted NT
                              - I reconnected them

                              (3b) at this point the OCO orders were still in TWS and were picked up by NT without problem.

                              (3c) I re-enabled the strategies

                              (4) immediately the OCO orders mentioned in (1) were cancelled and the strategy went into 'pending' status (yellow).

                              (5) I was left with a naked position in the market

                              (6) I disabled the strategies.

                              (7) I closed the position

                              (8) I changed the NT configuration so the strategies could start from scratch

                              (9) I re-enabled the strategies

                              (10) the one which had a position that I'd cancelled immediately 'synced'

                              (11) it put on the position it should have

                              (12) it placed OCO orders surrounding the position.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              602 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              347 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              559 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              559 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X