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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        63 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        35 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        54 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        61 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        48 views
        0 likes
        Last Post CarlTrading  
        Working...
        X