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 judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          59 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Today, 06:52 PM
          4 responses
          36 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Today, 07:39 PM
          0 responses
          7 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Today, 03:01 PM
          2 responses
          21 views
          0 likes
          Last Post helpwanted  
          Started by cre8able, Today, 07:24 PM
          0 responses
          10 views
          0 likes
          Last Post cre8able  
          Working...
          X