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 NullPointStrategies, Today, 05:17 AM
      0 responses
      19 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      119 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X