• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

This was an exit order but there is no position exist to exit

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

    This was an exit order but there is no position exist to exit

    Hello

    I want to use output to debug my code, but I keep getting this message “This was an exit order but there is no position exist to exit” and unable to see the my printed value, because it displays repeated thousands of time, could you please let me know what should I do to prevent this happening

    thanks!

    #2
    Attachment
    Attached Files

    Comment


      #3
      Hello Bobisam,

      Thank you for your post.

      This message will appear when your strategy calls ExitLong or ExitShort but no position exists to exit. You can check the current strategy position by referencing the Position.MarketPosition enum. You might need to add checks for an actual position before calling ExitLong()/ExitShort().

      e.g.

      Code:
      if(Position.MarketPosition == MarketPosition.Long && <Exit conditions here>)
      {
          ExitLong();
      }

      Please let me know if you have any additional questions.
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        Thanks! It is working now

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Arkadiy_B, Today, 06:43 AM
        0 responses
        2 views
        0 likes
        Last Post Arkadiy_B  
        Started by leontancfa, Today, 06:09 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by soulfx, 12-01-2017, 08:44 AM
        3 responses
        1,019 views
        0 likes
        Last Post NinjaTrader_EricB  
        Started by Parmenides48, 04-09-2019, 03:32 AM
        10 responses
        53 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by NinjaCustomer, Today, 01:48 AM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_EricB  
        Working...
        X