Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy halted unexpectedly

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

    Strategy halted unexpectedly

    This morning my strategy put on a position and attempted to place target and stop, and hit a brickwall so to speak, cancelled its orders, closed its position and disabled itself. It seems old inactive orders were to blame.

    27/01/2011 06:15 Default ForexMorningTrade unable to manage order [Order='49301920b05f490faeeeaf040799e593/U618350' Name='Stop loss' State=PendingSubmit Instrument='$GBPUSD' Action=Sell Limit price=0 Stop price=1.58655 Quantity=0.1M Type=Stop Tif=Gtc OverFill=False Oco='$GBPUSD/0000da93.4d3cd836.01.01-314' Filled=0 Fill price=0 Token='23d9e5bbe0a14807b52e8b55a20462ba' Gtd='01/01/0001 00:00:00'] - Order 'Sell [email protected] STP (Working)' already open! $GBPUSD


    The order it mentions that was supposedly 'already open' was in fact filled yesterday and obviously totally inactive:

    26/01/2011 07:31 Order Order='479215406/U618350' Name='Stop loss' New state=Filled Instrument='$GBPUSD' Action=Sell Limit price=0 Stop price=1.57895 Quantity=0.1M Type=Stop Filled=100000 Fill price=1.57878 Error=NoError Native error=''

    This is a pretty bad news. I have relied on this system since November to trade correctly. But it's done this twice this week, and I have missed out on $800 now so I want to get this sorted out, identify the problem and get a work-around as soon as possible.

    I have attached the logs. I think you should be able to see the story clearly in the log for today and yesterday.

    This is NT7.0.1000.1 64-bit on Win7-64 using Interactive Brokers.

    I attached images of my Strategies options dialog, and the strategy edit dialog.

    Thanks
    Attached Files

    #2
    adamus, sorry for the frustration - we will take a look at the files provided - which TWS # are you running in this setup?

    Comment


      #3
      I am running IB TWS 912.8 on Java 1.6.0_21.

      Comment


        #4
        This morning all my orders switched into an 'unknown' state.

        There were still there in IB TWS, and in the Orders tab in the Control Center they appeared with the status 'Unknown'.

        I restarted IB TWS and then NT recognised their state properly, so I cancelled them all and started the strategies again with the settings I use to allow the orders to be resubmitted. Hopefully this is the end of the situation.

        I have added this report to the end of this thread because I think this one is probably connected to the issue above.

        I have attached my logs where it shows hte communcation where the orders were changed to state: unknown.
        Attached Files

        Comment


          #5
          adamus, thanks for the added info - the supported TWS for latest NT7 R2 would be the 911.3 release.

          If I look through your logs I see again a large # of connection issues as with prior reports we investigated, it would be good to take some time to work on ironing those out or at least minimizing them. After the reconnection there was no event received for NT to recognize the changed orderstate, some orders were never really submitted as the connection loss hit showing 'presubmitted' state in the TWS.

          Comment


            #6
            My attempts to improve my connection have been on-going for the last six months. It seems the only alternative left to me is to change ISP.

            The disconnects showing in the log though were never something I was concerned about before. My more immediate concern was to solve the problem downloading historical data from IB. I have an adequate work-around for that. However it is never a problem during the early morning when these disconnects from the live feed occur. I rarely see any disconnects after 7:00am on the live feed.

            I can't get any sensible or intelligent response on this from IB Support, but I assume that the connection to the historical data servers in the late part of the day fails because it's time-critical and my connection gets degraded during peak use at my ISP. However that would not be the case for the early morning disconnects from the live feeds. I need some sort of rational explanation for these disconnects so that I know what needs to be improved, rather than a blanket suggestion to change ISP.

            Comment


              #7
              adamus, unfortunately we're not network engineers in the position to debug the setup you're using, but from the your logs seen in working with your current and past issues I can conclude that the connection stablity / quaility you're working with has a major impact in performance and reliability seen - I'm not sure about alternative ISP's in your area or if they would some kind of trace analysis / debug to your IP range needed for the IB server access but I would be good to consider as option to proceed. If you're trading for larger percentages of the trading days and rely on frequent order modifications a backup connection using a different tech would be a solid approach, too.

              Comment


                #8
                Yes. Sorry I didn't mean to sound like I was ranting again. You are right about requiring a second back-up connection.

                I have been looking into the market and it seems that Virgin Broadband have a high quality service.

                Comment


                  #9
                  I just analysed the log files and since 8th Jan, I have had 164 disconnects on the IB price feed ("28/01/2011 22:01:06 Connection IB: Primary connection=Connected, Price feed=ConnectionLost")

                  50% of the disconnects occur between 4am and 5am. Another unresolvable mystery at British Telecom no doubt.

                  Comment


                    #10
                    Exactly the same thing happened to me this morning as I described in the first message from Jan 27th.

                    Reading through the thread, I realise it digressed and focussed on the "order state unknown" issue which was caused by network disconnections.

                    This time despite the network disconnections occurring as usual, this had no bearing on the problem described in the first post - that my strategy couldn't submit its target and stop and so closed itself down and another US$400 went begging. It's getting expensive to use NinjaTrader if this happens every month.

                    The logs show a period of about 5 seconds at 06:00AM today (Feb 22) when the entry was placed, the position established and the exit orders placed but failed. There was no disconnection at this time.

                    I believe it has something to do with the order handling and the fact that the system had placed exactly the same order configuration yesterday - although of course the orders were now inactive.

                    I have attached the logs and traces.
                    Attached Files

                    Comment


                      #11
                      Thanks for the follow up adamus, I'll clarify with development why this message might be seen, however one thing I don't follow - a second later both your stop and target orders go to regularly working / accepted state?

                      22/02/2011 06:00:03|0|4|ForexMorningTrade unable to manage order [Order='b0695a6e05e049bb8b4784b1907039d4/xxx' Name='Stop loss' State=PendingSubmit Instrument='$GBPUSD' Action=BuyToCover Limit price=0 Stop price=1.62115 Quantity=0.1M Type=Stop Tif=Gtc OverFill=False Oco='$GBPUSD/00012be9.4d62e7e8.01.01-200' Filled=0 Fill price=0 Token='45a88a473ddf4628949c7e468df8f2f4' Gtd='01/01/0001 00:00:00'] - Order 'BuyToCover [email protected] STP (Working)' already open! $GBPUSD
                      22/02/2011 06:00:03|0|4|ForexMorningTrade unable to manage order [Order='84ae9510e2db41c5a49cf9585f047b6a/xxx' Name='Profit target' State=PendingSubmit Instrument='$GBPUSD' Action=BuyToCover Limit price=1.61315 Stop price=0 Quantity=0.1M Type=Limit Tif=Gtc OverFill=False Oco='$GBPUSD/00012be9.4d62e7e8.01.01-200' Filled=0 Fill price=0 Token='2851c79004f24c328323d2b63d79e56f' Gtd='01/01/0001 00:00:00'] - Order 'BuyToCover [email protected] LMT (Working)' already open! $GBPUSD
                      22/02/2011 06:00:03|2|4|Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed. 2109
                      22/02/2011 06:00:04|2|4|Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed. 2109
                      22/02/2011 06:00:04|1|32|Order='1846706118/xxx' Name='Stop loss' New state=Accepted Instrument='$GBPUSD' Action=BuyToCover Limit price=0 Stop price=1.62115 Quantity=0.1M Type=Stop Filled=0 Fill price=0 Error=NoError Native error=''
                      22/02/2011 06:00:04|1|32|Order='1846706119/xxx' Name='Profit target' New state=Accepted Instrument='$GBPUSD' Action=BuyToCover Limit price=1.61315 Stop price=0 Quantity=0.1M Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
                      22/02/2011 06:00:04|1|32|Order='1846706119/xxx' Name='Profit target' New state=Working Instrument='$GBPUSD' Action=BuyToCover Limit price=1.61315 Stop price=0 Quantity=0.1M Type=Limit Filled=0 Fill price=0 Error=NoError Native error=''
                      22/02/2011 06:00:04|1|64|Instrument='$GBPUSD' Account='xxx' Avg price=1.61717 Quantity=0.1M Market position=Short Operation=Insert Currency=UsDollar

                      22/02/2011 06:05:19|1|2|IB: Primary connection=Connected, Price feed=ConnectionLost

                      After that happened your connection issues were back again.

                      Comment


                        #12
                        OK I think I see what's going on here. The underlying problem is shown by my error handling, sorry that I didn't originally flag this up. This are the logged errors again:

                        22/02/2011 06:00:03 Default ForexMorningTrade unable to manage order [Order='b0695a6e05e049bb8b4784b1907039d4/U618350' Name='Stop loss' State=PendingSubmit Instrument='$GBPUSD' Action=BuyToCover Limit price=0 Stop price=1.62115 Quantity=0.1M Type=Stop Tif=Gtc OverFill=False Oco='$GBPUSD/00012be9.4d62e7e8.01.01-200' Filled=0 Fill price=0 Token='45a88a473ddf4628949c7e468df8f2f4' Gtd='01/01/0001 00:00:00'] - Order 'BuyToCover [email protected] STP (Working)' already open! $GBPUSD

                        The important bit is the last bit - this refers to one of the exit orders from the previous day.

                        The other half is still open too:

                        22/02/2011 06:00:03 Default ForexMorningTrade unable to manage order [Order='84ae9510e2db41c5a49cf9585f047b6a/U618350' Name='Profit target' State=PendingSubmit Instrument='$GBPUSD' Action=BuyToCover Limit price=1.61315 Stop price=0 Quantity=0.1M Type=Limit Tif=Gtc OverFill=False Oco='$GBPUSD/00012be9.4d62e7e8.01.01-200' Filled=0 Fill price=0 Token='2851c79004f24c328323d2b63d79e56f' Gtd='01/01/0001 00:00:00'] - Order 'BuyToCover [email protected] LMT (Working)' already open! $GBPUSD

                        If you look in the logs at 22/02/2011 00:37:01 you'll see that the orders referred to as 'already open' were in fact respectively executed and cancelled at that point when the previous trade closed.

                        22/02/2011 00:37:01 Order Order='1846706075/U618350' Name='Stop loss' New state=Cancelled Instrument='$GBPUSD' Action=BuyToCover Limit price=0 Stop price=1.62695 Quantity=0.1M Type=Stop Filled=0 Fill price=0 Error=NoError Native error='Order Canceled - reason: (202)'

                        22/02/2011 00:37:02 Order Order='1846706076/U618350' Name='Profit target' New state=Filled Instrument='$GBPUSD' Action=BuyToCover Limit price=1.61895 Stop price=0 Quantity=0.1M Type=Limit Filled=100000 Fill price=1.61895 Error=NoError Native error=''

                        So the problem is that the NT API order objects for these filled/cancelled orders which I am holding references to are still in OrderState.Working.

                        So it looks like NT is abandoning these orders. One should be OrderState.Filled and the other OrderState.Cancelled

                        Under what conditions are they abandoned? Is it because they are set by SetProfitTarget and SetStopLoss?

                        Thanks

                        Comment


                          #13
                          adamus, I'm sorry don't follow you in your analysis - the set orders would not provide any IOrders for reference per se and you seem to compare two completely different sets of orders here, just looking at OrderID and token for example. Could it be your strategy restart caused a slightly different order layout needed? It would need to be an exact 100% match to be considered 'persistable' for NT as you move across instances of a strategy.

                          Comment


                            #14
                            The best explanation I can give you is this: I track all IOrders which pass through OnOrderUpdate and OnExecution.

                            The IOrders that my strategy sees as OrderState.Working are IOrders that were passed to it via the OnOrderUpdate when NT followed SetStopLoss and SetProfitTarget instructions and placed stop and targets on the execution of the strategy's entry order.

                            From my point of view, strategy restarts are irrelevant. If the orders had changed, that would be irrelevant. We are talking about orders that NT7 should automatically inactivate after the end of the previous trade. Obviously the orders with the broker IB were inactivated but my strategy was left holding IOrder objects that were not updated to that last inactive status (executed or cancelled).

                            I am not seeing any differences that would make me think that a restart problem had occurred.

                            Am I being clear? I realise it must sound impossible but those log statements are reading directly from the IOrder objects and that's what they claim to be.
                            Last edited by adamus; 02-23-2011, 09:41 AM.

                            Comment


                              #15
                              Thanks for clarifying adamus, I follow what you say - if there's an issue tracking / updating the IOrder references NT holds we would still need a reproducible case scenario to 'hunt' it down - please let this simple sample here run on your simulation / paper account and see if the printed states from OnOrderUpdate() would not match your expectations - http://www.ninjatrader.com/support/f...ead.php?t=5790

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              88 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              48 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              30 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              34 views
                              0 likes
                              Last Post TheRealMorford  
                              Started by Mindset, 02-28-2026, 06:16 AM
                              0 responses
                              68 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Working...
                              X