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

How to Prevent Double Exit

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

    How to Prevent Double Exit

    Hi,
    I'm setting up a strategy with multiple exit conditions. On certain occasions it will give two exit signals and essentially take an extra opposite position.

    For example. I go Long at $10.00. I have exit signals that kick in and I ExitLong1 at $9.00. I have an instant other signal ExitLong2 at $9.00.

    I've tried to change the "IF" statements to "Else IF" and it still doesn't work.

    I also have the option "Wait Until Flat" set to yes.

    HELP!

    #2
    Hi krakken,

    Thanks for the post. NT's internal order management should not process further exit signals if there is not a position open. Even if you have multiple exits in the same code block, only one will be processed and the other is ignored with message "There already is a matching order with same prices and quantity'" or "This was an exit order but no position exists to exit".

    Using TraceOrders output will allow you to monitor these messages.

    What you describe sounds like it could be an overfill, where an order is filled after it is marked for cancellation. Do you receive overfill notification for these?
    Last edited by NinjaTrader_RyanM1; 08-29-2011, 02:44 PM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Ryan,
      No overfill errors. Its actually taking a position. So in the scenario I described above, the 2nd Exit Long, turns into a Short position.

      I'm testing this on market replay and am VERY concerned if something like this happened in Live.

      Comment


        #4
        This is generally not expected. If you can share some code and steps to see what you're seeing we can look into what may be happening here.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Nevermind...I fixed this by using the || (Or) clause instead of else if. Just a note for others who may encounter this.
          THanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by George21, Today, 10:07 AM
          0 responses
          2 views
          0 likes
          Last Post George21  
          Started by Stanfillirenfro, Today, 07:23 AM
          8 responses
          23 views
          0 likes
          Last Post Stanfillirenfro  
          Started by DayTradingDEMON, Today, 09:28 AM
          2 responses
          15 views
          0 likes
          Last Post DayTradingDEMON  
          Started by navyguy06, Today, 09:28 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          8 responses
          32 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X