Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Null reference issue in position.close

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

    Null reference issue in position.close

    Hi,

    I test my strategy on replay data.It gives exception (Null Reference)when I call Position.Close() function to close the position while Position object holds short position.Please help me out about this issue.

    Thanks,
    Irfan

    #2
    Hello,

    Position.Close is not a supported method and I have not tested this on MarketReplay. I would suspect it is not running on the Replay101 account and cannot find a position to close.

    I would recommend using the ExitLong() and ExitShort() methods which are known to work on the Replay101 account
    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks,

      I try this solution but this again give an exception that this method can not be called on unmanaged strategies.

      Comment


        #4
        If you're using unmanaged, you'd have to use SubmitOrder():

        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        671 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        379 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        582 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X