Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Reversing a position with a single order in an AddOn

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

    Reversing a position with a single order in an AddOn

    If I am long a single share, and I decide I want to be short a single share, is there a consensus/best practice way to do that with a single order? Does the answer vary by provider?

    For instance, if I am long 1 share, can I sell 2 shares to be short a share?

    I currently sell out and then short with two sequential orders, but that introduces latency I'd like to avoid if possible.

    Before I spend time experimenting with what may or may not work, I figured I'd ask to see if there is a time-saving easy answer from someone.

    This is via C# code from within an AddOn.

    Cheers.

    (I originally posted this question to Platform Technical Support, but the help I have gotten so far seems to imply this is a better place for this question.)

    #2
    Hello carnitron,

    Yes, you could place an order with a quantity of 2 to reverse the position.

    I recommend giving this a test manually using Chart Trader on the Sim101 or Demo account.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea! Your clear, concise answer is greatly appreciated. I will investigate this.

      Comment


        #4
        So, in the UI, with a TDA Sim account, I tried entering with a single share via market or limit order and then selling 2 shares with market or limit orders and everything worked as hoped. Selling 2 shares while being long 1 share resulted in being short 1 share.

        However, when I attempt to do this against my real live TDA account, it does not work. Instead, I get this dialog, which blocks the order:

        Click image for larger version  Name:	image.png Views:	0 Size:	5.8 KB ID:	1297243

        Questions:

        1) Is there a way around this restriction in the live account? (Technically, I only actually care about the AddOn API, not whether I can do this in the UI.)
        2) Does this vary by vendor? Like maybe TDA imposes this restriction, but other brokers do not? If so, do you have a list of which brokers support or do not support reversals like this?

        Thanks in advance for any help you can provide here. Cheers.

        Comment


          #5
          Hello carnitron,

          The message is likely telling you the account is not allowed to have a short position.

          "Is there a way around this restriction in the live account? "
          You would need to contact TDA your broker for any information about your account, or to change the account settings so that the account is allowed short positions.

          "Does this vary by vendor? Like maybe TDA imposes this restriction, but other brokers do not?"
          Yes, this would vary by broker and the specific account settings.

          "If so, do you have a list of which brokers support or do not support reversals like this?"
          I do not have a list of brokers and would not be able to provide any specifics about accounts that you would need to talk to the broker about.

          NinjaTrader Brokerage (a futures brokerage) does allow for short positions with proper margin requirements.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            My account supports short positions. Here is a picture from live just now showing it:

            Click image for larger version  Name:	image.png Views:	0 Size:	34.1 KB ID:	1297266

            I think I have seen errors of this nature in other clients as well. Some will complain about boxed positions, even though that's not the intent.

            Further thoughts? What is my best path forward here? Call various API support teams at different brokers and find out which ones support this operation?

            I will email TDA's API support, as this is a question they might actually be able to answer, heh.
            Attached Files

            Comment


              #7
              Hello carnitron,

              If the account allows for short positions you will need to call your broker to ask why your broker has rejected the order.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Ok I will do that and report back.

                Comment


                  #9
                  I recently had the same problem and found that using just one order to flip my position made things faster and smoother for my trading. It's definitely a good idea to play around with what your trading platform can do or to ask their support team if you can do this with what you've got set up.

                  Comment


                    #10
                    So TDA phone support has told me to email TDA API support b/c there is a setting "Auto Position Effect" that they need to turn on for my account. I have sent the email. We'll see how fast they get back to me and I can get into a position (no pun intended) where I can test the results.

                    Thanks for the feedback Clarrissa. I definitely feel you here, there is a pretty important class of signal scenarios in front of me here that I suspect I can turn from red to green with this one change, heh. We shall see!

                    Comment


                      #11
                      My pleasure! But keep us updated with their respond.

                      Comment


                        #12
                        TDA got this in for me today and I confirmed that doing this at the UI level now works as expected. Confirming down at the API level will require some work for me, but it's probably reasonable to assume that it works, since it was an issue at the broker level to begin with. Apparently this is a safety feature to prevent less experienced traders from making mistakes and getting confused. On the upside, TDA does not then turn your single reversal order into two orders under the covers -- it is kept as a single order all the way through to the clearinghouse, preserving the latency benefits through the entire transaction. So, a happy ending!

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by fx.practic, 10-15-2013, 12:53 AM
                        5 responses
                        5,404 views
                        0 likes
                        Last Post Bidder
                        by Bidder
                         
                        Started by Shai Samuel, 07-02-2022, 02:46 PM
                        4 responses
                        95 views
                        0 likes
                        Last Post Bidder
                        by Bidder
                         
                        Started by DJ888, Yesterday, 10:57 PM
                        0 responses
                        8 views
                        0 likes
                        Last Post DJ888
                        by DJ888
                         
                        Started by MacDad, 02-25-2024, 11:48 PM
                        7 responses
                        160 views
                        0 likes
                        Last Post loganjarosz123  
                        Started by Belfortbucks, Yesterday, 09:29 PM
                        0 responses
                        9 views
                        0 likes
                        Last Post Belfortbucks  
                        Working...
                        X