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 rocketman7, Today, 09:41 AM
        2 responses
        4 views
        0 likes
        Last Post rocketman7  
        Started by traderqz, Today, 09:44 AM
        1 response
        2 views
        0 likes
        Last Post traderqz  
        Started by rocketman7, Today, 02:12 AM
        7 responses
        31 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by guillembm, Yesterday, 11:25 AM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by junkone, 04-21-2024, 07:17 AM
        10 responses
        149 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X