Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exiting Positions Question

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

    Exiting Positions Question

    Hi,

    I have a situation in which I cannot seem to figure out how to exit a position. Here is the scenario: I enter a long position on stop, and the entry triggers. Therefore I am now long one contract. On the next bar, I get a signal stating that I should reverse my position to a short, 1 contract. Okay. I execute the following

    entryOrder = EnterShortStop(0, true, DefaultQuantity, entryPrice, "Long->ShortEntryReversal");

    So far so good. Here is the issue. The short entry does not trigger because the stop price is not reached. As far as the strategy is concerned, however, I am still long. Is there a way to kill the long position? Also, is there a way to exit a position with a market order when the position was entered on stop? Thank you.

    #2
    Hello Zeos6,

    You can exit a long position with ExitLong(). This will submit sell exit order for the long position.

    I do not recommend submitting the ExitLong() and EnterShortStop() on the same bar update as this will cause you to go into the short position with double the positions you may have wanted.
    http://www.ninjatrader.com/support/h...l?exitlong.htm

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hi Cal,

      Thank you for your reply. So if I understand you correctly, if I have entered a long position on stop, I can exit that position anytime with a market order by using ExitLong(). I would however like to exit the long and enter the short on the same bar. Is there a way to do this?

      Comment


        #4
        Zeos6,

        With the Managed approach, if you submit an entry order for the opposite direction it will close out the position and enter the new position.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Hi Cal,

          Yes, that is true but if the new position does not trigger, it means you are still in the initial position. In other words, if I am long and I enter a short on stop but the short has not yet triggered, I am still long, which I do not want to be. Can this be handled better with the unmanaged approach?

          Comment


            #6
            Zeos6,

            At this point you would want to implement additional logic that if the Stop doesn't get filled then it would get out of the long position.

            With the unmanaged approach you can have it so that it exits the long before entering the short position as well without the double entry of the positions.
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              Hi Cal,

              Thank you. The control of the unmanaged approach is what I was looking for. I think what you are telling me is that I could exit the long and enter the short on the same bar, in addition to avoiding the double position entry that comes with the managed approach.I will modify the strategy for the unmanaged approach to get the level of control I need.

              Thanks for all your help.

              Comment

              Latest Posts

              Collapse

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