• 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 Abilene, Today, 01:27 AM
        0 responses
        4 views
        0 likes
        Last Post Abilene
        by Abilene
         
        Started by simjs, Yesterday, 08:11 PM
        0 responses
        3 views
        0 likes
        Last Post simjs
        by simjs
         
        Started by mrlucky1x, Yesterday, 06:01 PM
        0 responses
        3 views
        0 likes
        Last Post mrlucky1x  
        Started by dedouglas, Yesterday, 03:17 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Jugado, Yesterday, 02:22 PM
        2 responses
        30 views
        0 likes
        Last Post Jugado
        by Jugado
         
        Working...
        X