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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        65 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        149 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        99 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        286 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X