Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

autotrading, averagefill price.

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

    autotrading, averagefill price.

    I am writting a c# application that is dependant on getting the exact fill price of a order. As I am testing my code i am using the simulator with ninja to bug test first before using live data.
    Iim sure that the command "AvgFillPrice(OrderID)" works however i need to get the last orderID placed. I used the command "Orders(account)" to get a list of all the order placed. This did not return the most recent order in the listing.
    So then i tried NewOrderID(); I got the order and then placed a @Market order using the returned OrderID. The order was placed but it was allocated a different OrderID even though i specified it.
    Can you help me with a working example of how to get the entry price of the last order placed? or how to place an order and allocate it a OrderID.

    Thank you in advance..

    #2
    Just responded to your note send to support...

    Comment


      #3
      I have tried what you suggested, which was
      ShortOrderID = Ninja.NewOrderId(); .
      Command("PLACE", Short_Account, Ninja_Instrument, "SELL", 1, "MARKET", 0, 0, "", "",ShortOrderID, "", "");
      string tmporders = Ninja.Orders(Short_Account);

      tmporders just returns a null. and when i check the log. the order get submitted with the OrderID generated in the first line of code but then it gets changed to a different number.

      All i need is a way of getting the order id, for
      1. being able to cancel a limit order. and
      2. getting the exact fill price of an order. i need the fill price to be able to calculate my exact Profit or Loss.

      Any one have a work around??

      Comment


        #4
        pnewen,

        You are likely just trying to access it too early. Wait for the order to actually exist before calling Orders().
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I did have a sleep command in there as well.
          I got it working. you need to have a OCO value in the Ninja.command(....)
          once i entered that everything started work correctly.
          thanks for your support.
          The rest is just some coding now
          Happy Days. !

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          75 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          45 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          26 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          32 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          62 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X