Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question About Fetching Order Value

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

    Question About Fetching Order Value

    Hello Ninjatrader staff,

    What is the most efficient way to get the market value (not quantity) of a resting order such as a Buy Limit and Print out this value?
    When I use Print(S1.LimitPrice) I am getting this error in the Log tab "Error on calling 'OnBarUpdate' method on bar 5610: Object reference not set to an instance of an object".

    Thank you in advance for your reply!
    Last edited by GLFX005; 12-17-2020, 09:30 AM.

    #2
    Hello GLFX005, thanks for writing in.

    It looks like you have an order object reference that is null at the time you access the LimitPrice property. Check that the order is not null before accessing it, and make sure it's being set to an order before doing this as well.

    S1 = ExitLongLimit(...);

    if(S1 != null)
    {
    Print(S1.LimitPrice);
    }

    Alternatively, you can capture the limit price within the OnOrderUpdate method once it's submitted (in the working or accepted state):

    https://ninjatrader.com/support/help...rderupdate.htm

    Another alternative would be looping through the Account.Orders collection:
    https://ninjatrader.com/support/help...rs_account.htm

    Please let me know if you have any questions on this material.

    Comment


      #3
      Thank you Chris, that solved the issue!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      89 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X