Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AverageFillPrice

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

    AverageFillPrice

    I spent a while digging through an error to discover that Average Fill Price reported is exact ie not rounded to tick value - which was causing me a lot of errors. That's fine and I understand why you would report it that way so could I suggest a feature.
    Could we have asomething like
    RoundedAverageFillPrice()?
    instead of having to do this
    Instrument.MasterInstrument.RoundToTickSize(execut ion.Order.AverageFillPrice);

    thanks

    #2
    Hello Mindset,

    If your logic relies on rounded values being in a specific format you would need to round them to the tick size by using RoundToTickSize or if you want to round to a custom decimal you can use the C# function Math.Round. The value is otherwise going to be what the broker sends back based on the fills so that would not be something the platform would automatically round so the true value is known.

    Are you asking to always have the average fill price rounded to the instruments tick size even if that may not be the true price where the order/s were filled? I could see that also causing issues for users expecting their offsets to be calculated based on the real average cost of the submitted orders rather than a rounded value. The rounded value comes from the instruments defined tick size so that could cause problematic values to be produced depending on the instruments configuration.

    Comment


      #3
      Hi Jesse

      Thanks for the reply.
      I ask this because I am having difficulty with a sporadic error where my profits and stops don't trigger and it seems to relate to when I get a price that is NOT a whole tick value eg 5500.333 on the ES.
      Everything works 100% in Sim - I think becaue a 'non tick' price cant be produced by the Algorithm? Perhaps you can confirm this. And if so perhaps you can change the algo so that it does; to more faithfully represent live trading.
      When I go live i get issues and it only seems to happen when I get different fills that result in these 'non tick' prices.

      Emphatically, NT should report the broker feed price. What I would like though is the ability to have a separate keyword
      RoundedAverageFillPrice. I am unsure if Instrument.MasterInstrument.RoundToTickSize(execut ion.Order.AverageFillPrice) - is actually not giving me more issues under the hood.​

      Of course it could also be something completely different eg my coding, but I have drilled it down to this issue.
      Last edited by Mindset; 06-19-2024, 10:51 PM.

      Comment


        #4
        Hello Mindset,

        I believe the correct way to look at this would be to address the condition being used to match the output from your broker. What type of condition is being used and what are the specific values you see when it does work and does not work? Using a Print to make a comparison between the values of working and not working would let us know why the condition isn't working as expected.

        I will put in a feature request for a rounded price however I am still not certain what the exact request would be, are you asking to lock the price to the tick size from the instrument or have some manual configurable setting for that? The RoundedAverageFillPrice is something you can already do in your script by using the RoundToTickSize or Math.Round function with the price you get back from the execution event or from the positions average price. You would make either a class level variable or just convert the price when you need to use it in your condition.



        Comment


          #5
          Hi Jesse
          Thanks for the response.
          I think a hardcoded RoundedAverageFillPrice would help more people understand that the AverageFillPrice may NOT be at a tick value. Sounds obvious, I know and you are correct in that you can easily manipulate yourself; however, it took me a day or two of investigation to find this root cause, which, had the help files shown 2 types of AverageFillPrice I might have twigged a lot earlier.
          Further most people who use AverageFillPrice in their strategies would use it to place stops and targets I would have thought so this new keyword would make that plain and simple with no potentail 'hidden' logic errors.
          I am suggesting this as an ADDITIONAL word and NOT the default.

          I don't think it needs to be anything other than rounded to nearest TickSize.
          As I stated above - this issue does not seem to occur when using the Sim feed - so it only rears it's head when you have real money and the strategy disables violently - which is not a pleasant experience!

          Comment


            #6
            Hello Mindset, Thank you for confirming that I will put in a note about that. For the time being you will need to round the numbers yourself to match how your condition is expected to work. You can use Print statements to debug your code in the use case where it is not working to know how you may need to adjust the condition or rounding.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            557 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X