Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetAtmStrategyPositionAveragePrice race condition

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

    GetAtmStrategyPositionAveragePrice race condition

    how can status[0] print the correct fill price and GetAtmStrategyPositionAveragePrice return zero at the same instant?

    i.e. the order is filled....status knows the value....why does GetAtmStrategyPositionAveragePrice not pick it up?

    #2
    Please post simple as possible code sample showing what you are doing and when you are accessing it. Thank you.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      if (orderIdLONG.Length > 0)
      {
      string[] status = GetAtmStrategyEntryOrderStatus(orderIdLONG );
      if ( status.GetLength(0) > 0 && status[2] == "Filled" )
      {
      entryPriceLong = GetAtmStrategyPositionAveragePrice(orderIdLONG) ;
      Print ( " entryPriceLong "+entryPriceLong+ " actual "+status[0] );

      although order is filled and a fill price is available, only status[0] returns actual fill price while
      GetAtmStrategyPositionAveragePrice returns 0

      problem would be solved if status[0] could be converted from string to double... i.e. since GetAtmStrategyPositionAveragePrice is not current at same time

      Comment


        #4
        Think you can try

        Convert.ToDouble(string);
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          thanks Josh...works fine

          any idea why GetAtmStrategyEntryOrderStatus does not per my code above?

          Comment


            #6
            Most likely as you've stated already.

            Order updates come, then executions, then position updates. You are just accessing it too early.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              right...thanks

              probably need to pickup via OnPositionUpdate

              convert is easier and works fine

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              601 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              347 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              559 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              558 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X