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...
    BertrandNinjaTrader Customer Service

    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 traderqz, Today, 12:06 AM
          6 responses
          12 views
          0 likes
          Last Post traderqz  
          Started by Skifree, Today, 03:41 AM
          3 responses
          12 views
          0 likes
          Last Post Skifree
          by Skifree
           
          Started by traderqz, Yesterday, 09:06 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by guillembm, Today, 11:25 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by owensd, 04-21-2024, 11:34 PM
          9 responses
          34 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X