• 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 Stok, Today, 08:44 AM
        0 responses
        2 views
        0 likes
        Last Post Stok
        by Stok
         
        Started by Longhornmark, Today, 08:22 AM
        0 responses
        4 views
        0 likes
        Last Post Longhornmark  
        Started by akuntysh, Today, 12:02 AM
        2 responses
        10 views
        0 likes
        Last Post akuntysh  
        Started by hir04068, Today, 04:26 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by Revan, Yesterday, 11:53 PM
        4 responses
        27 views
        0 likes
        Last Post NinjaTrader_Jim  
        Working...
        X