Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Close Position Blocked while cancelling orders

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

    Close Position Blocked while cancelling orders

    I noticed that there is a delay when closing positions in Ninjatrader. To test this I made a simple ATM strategy with 3 targets and 3 stops of 1 contract each. I submitted multiple market orders using this ATM strategy building a position of 117 on a demo account with Forex.com. I then went to the positions tab and right clicked the position and chose "ClosePosition".

    As you will see from the Time Column on the orders tab below, It took an agonising 4 seconds for all the Stop and Target orders to cancel before the order to close the position was finally submitted last. Furthermore if I submit more positions, with many more bracket orders the operation fails with the error "Close Operation Failed. Operation timed out. Manually close your position" (I mean duh - that's what I'm trying to do - manually close my position). I think 5 seconds is the limit Ninjatrader waits for all the Stop and Target orders to be cancelled before timing-out and leaving the position open.

    This is a very poor implementation. Positions need to be closed immediately - often in emergencies. Taking 4 seconds to close a position isn't really acceptable. And this feature is completely useless if it times-out waiting for orders to cancel and ultimately failing to do what its intended to do leaving the position open.

    I realise my test is an extreme case, however I have observed delays in closing positions in more realistic scenarios on my live account with just 5 or 6 stop/target bracket orders where it took a second or two to close my position and I saw price slip against me during this time.

    The issue could be exacerbated by delays with the broker's API and network latency etc.





    Click image for larger version  Name:	image_2021-12-29_144051.png Views:	0 Size:	145.5 KB ID:	1183601



    Click image for larger version  Name:	image_2021-12-29_150311.png Views:	0 Size:	3.6 KB ID:	1183602
    Last edited by kevinenergy; 12-29-2021, 10:01 AM.

    #2
    Hello kevinenergy,
    Thank you for writing in.

    CRITICAL — If your inquiry ever involves live orders, please always reach out to your broker's Orders Desk immediately to confirm and manage your live orders and positions.


    When submitting orders from NinjaTrader, they will go through various states to let you know where the order is at in its submission process. Generally the following, but not always and it changes by broker.
    • When there are order submission delays, this normally correlates to some kind of internet or network connection issues, but we would need to see your specific files to verify and provide further instructions based on what we find specifically.

    As well, the NinjaTrader platform has no control over the Brokerage and Exchange sending the appropriate order updates, it simply waits for the updates to update the platform's information.
    • Submitted
      • The NinjaTrader us submitted the signal to the Brokerage/Exchange
    • Accepted
      • It has made it off of your computer and to the Brokerage's servers and the Brokerage has sent a signal letting the NinjaTrader platform know it was Accepted by them.
      • If your computer turned off, this order would continue its journey.
    • Working
      • The NinjaTrader platform has received an update that the order is now Working at the Exchange's Servers and the order is in the hands of the Exchange and would fill if the market dictated
    • From here the or could be Filled, Canceled, or Closed
      • Filled
        • The Order has been filled
      • Cancel and Close:
        • Turn into "Cancel Submitted" or "Close Submitted"
        • Then "Canceled" or "Closed"
    Please see the following Help Guide links for more information on what the different order states mean and how they differ between providers:
    • Please see the following link for more information on what the different order states mean:
    • Please see the following link for more information on where your orders reside based on provider:


    When it comes to analyzing what is happening with these orders and what could be causing these delays, we would need to take a deeper look into your Log and Trace files specifically.

    If you would like for us to provide more information on what could be happening with your orders, please write into Platform Support with your Log and Trace files so that we may look into your orders specifically.


    Please use the steps below to Automatically send us your log and trace files from your platform.

    You can do this by going to the Control Center-> Help-> Email Support
    • Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.
    • Please reference the following ticket number in the body of the email: Clayton ATTN 3418076

    If you are unable to use the Email Support feature, please use the Manual steps below:
    • Open Windows File Explorer (hotkey = Windows key + E) Then navigate to, "Documents" (sometimes called, "My Documents") > 'NinjaTrader 8' folder
    • Right-click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
    • Send the 2 compressed folders as attachments to PlatformSupport[AT]NinjaTrader[DOT]com
    • Include "Clayton ATTN 3418076" in the Subject line
    • Once complete, you can delete these compressed folders.



    Last edited by NinjaTrader_Clayton; 12-30-2021, 08:25 AM.
    Clayton G.NinjaTrader Customer Service

    Comment


      #3
      Hi Clayton,

      thanks for the response. I've sent you my trace file for my tests of this issue this afternoon. I think the problem is simply that Ninjatrader submits the Cancellations for the stop/targets first and then submits the market order to close the position last, the requests get backed up causing a delay in closing the position - or worse: a timeout which leaves the position open. I think this approach is dangerous and should be reconsidered. The priority when closing a position is getting flat as quickly as possible; it only takes one request to go flat and many requests are needed to cancel the bracket orders.

      I've written an extension which I'm going to use for now. I've attached this if anyone needs it.






      Attached Files
      Last edited by kevinenergy; 12-29-2021, 03:05 PM.

      Comment


        #4
        Hello kevinenergy,
        Thank you for the update.

        I have not seen an email to me that correlates to what we have been discussing. If you look at the email you sent in directly, what is the ticket number within that ticket?
        • Did you include "Clayton ATTN 3418076" within the Subject line?

        I want to ensure that your email has been received by us and that I or another colleague is looking into your files and inquiry further.

        Clayton G.NinjaTrader Customer Service

        Comment


          #5
          Hi Clayton

          I think i included the reference in the body of the message as instructed. I can sent it again if you can't find it.

          Comment


            #6
            Originally posted by kevinenergy View Post
            I think i included the reference in the body of the message as instructed. I can sent it again if you can't find it.
            >> Include "Clayton ATTN 3418076" in the Subject line <-- first request
            >> Did you include "Clayton ATTN 3418076" within the Subject line? <-- follow-up

            The all-mighty dastardly disconnect strikes again ...

            Comment


              #7
              I am capable of following instructions. Thanks.

              If using NinjaTrader 8, please use the steps below to Automatically send us your log and trace files from your platform.

              You can do this by going to the Control Center-> Help-> Email Support
              • Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.
              • Please reference the following ticket number in the body of the email: Clayton ATTN 3418076

              If you are using NinjaTrader 7 ……. Etc

              Comment


                #8
                I see your point, my bad.

                Comment


                  #9
                  Clayton,

                  I have resent the log and trace files for the period in question, and placed Clayton ATTN 3418076 in the Subject as well as the body.

                  I don't feel comfortable disclosing my entire log and trace files, so I have sent two Support Emails via the Ninjatrader help menu and attached one with the Trace file and one with the Log file for the period in question when I was aggressively testing this issue. The support function doesn't let you attach two files to the one request so I had to send two.... they were only 30 seconds apart.

                  Comment


                    #10
                    Originally posted by kevinenergy View Post
                    Hi Clayton,

                    thanks for the response. I've sent you my trace file for my tests of this issue this afternoon. I think the problem is simply that Ninjatrader submits the Cancellations for the stop/targets first and then submits the market order to close the position last, the requests get backed up causing a delay in closing the position - or worse: a timeout which leaves the position open. I think this approach is dangerous and should be reconsidered. The priority when closing a position is getting flat as quickly as possible; it only takes one request to go flat and many requests are needed to cancel the bracket orders.

                    I've written an extension which I'm going to use for now. I've attached this if anyone needs it.





                    Kevinenergy. Did this extension work for you? If so where do I install it? I couldn't close my trades after a very long delay like one minute. I kept getting the Close operation failed error too.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by traderqz, Yesterday, 04:32 PM
                    1 response
                    10 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by f.saeidi, Today, 05:56 AM
                    1 response
                    4 views
                    0 likes
                    Last Post Jltarrau  
                    Started by Jltarrau, Today, 05:57 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post Jltarrau  
                    Started by Stanfillirenfro, Yesterday, 09:19 AM
                    7 responses
                    51 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by TraderCro, 04-12-2024, 11:36 AM
                    4 responses
                    71 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Working...
                    X