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 andrewtrades, Today, 04:57 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        5 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        436 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        7 views
        0 likes
        Last Post FAQtrader  
        Started by rocketman7, Today, 09:41 AM
        5 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X