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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        50 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        22 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        16 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        23 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X