• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Fill prices not on tick increments

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

    Fill prices not on tick increments

    Hello,

    I'm doing backtesting on FGBS. I might be missing something obvious, but why does the fill engine allow fill prices which aren't on tick increments. E.g. buy limit order submitted for 109.505, fill price is 109.507. Tick Size is 0.005. See attached examples.

    thanks
    Dave
    Attached Files

    #2
    Hello,

    Thanks for the forum post.

    You are looking at the Average Price column and not the fill price of that exact trade. The average price is why you will see this since it is a simple average of entry prices.

    Have a great rest of the day.
    BrettNinjaTrader Product Management

    Comment


      #3
      Hi, thanks for the reply. There is only one contract per trade, so the everage price should be identical to the fill price.

      Comment


        #4
        Hello,

        You would need to check your code then.

        You will see that the time this occurred there were two buys on FGBL at the same time with two different entry names.

        -Brett
        BrettNinjaTrader Product Management

        Comment


          #5
          Hi Brett,

          I'm not sure why this would need my code checking. This is a question about what the fill engine is doing. I'm just submitting an order. Also, I don't see duplicate buys - look at my example, on 15/09 - only one trade.

          Comment


            #6
            Hello,

            I checked again I see the duplicate buy.

            Two buys in the same direction would average giving you a value that is an average. This average does not have to be a tick size increment and the answer to your question is this is expected with the fill engine and more precisely this isn't the fill engine doing this, Its the average price column.

            To clarify again, if you want to look at what the fill engine is doing you need to be in the executions tab looking at the exact execution data. Not averaged data on the trades tab.

            -Brett
            BrettNinjaTrader Product Management

            Comment


              #7
              If there is a duplicate buy entry then please tell me which two lines.

              OK, let me take a different approach. The executions tab confirms that the execution is at a tick increment. But the trades tab, and consequently the P&L has an entry price which is not the same as the exection. There is only ONE entry, for ONE contract, so no chance of an average price being different to the entry price. If you don't believe that, take a look at the attached trades and execs, and you will clearly see the first one, on 27/07 has an exec price of 108.270, but a trade entry price of 108.269

              I know what this is related to, and how to fix it (the limit price specified originally is 108.269. which is not a problem for market orders) but the behaviour of the trade tab and the P&L is quite clearly wrong.
              Attached Files

              Comment


                #8
                please see screenshot below where I see the two entries to explain this.
                Attached Files
                BrettNinjaTrader Product Management

                Comment


                  #9
                  Brett,

                  I completely fail to see how you could see those as duplicates, for the following reasons.

                  1. They are 16 days apart
                  2. The second one is an exit, not an entry
                  3. The average of the execution prices 109.455 and 109.505 is nowhere near 109.507

                  Furthermore,. and correct me if I'm wrong, but I would expect the average price of an order to be the average of all the executions for filling that order. So if the quantity is one contract and that's the minimum tradeable, then the average price for that order must be the same as the fill price and it's irrelevent whether there are other orders next to it that look the same.

                  Comment


                    #10
                    Hello,

                    Looking closer your results I'm having issue matching up the results to what you say. Believe I would need to replicate your results on my side at this point as from your screenshot you originally provided with the issue. All the actions are buy's from what I see which would lead me to believe that technically you would be in a 10L or more position according to what I'm seeing as there are no exits in this screenshot. They are all Buys with the buy name of LE's which mean long entries.

                    Please send in your steps to reproduce this with your strategy and send this into support at ninjatrader dot com ATTN: Brett so I can look closer into this.

                    -Brett
                    BrettNinjaTrader Product Management

                    Comment


                      #11
                      Brett,

                      See the scrollbar icon? That's not a full list of entries and exits. I provided the list just to show that the limit price and average price were different even for a a one contract order. See my previous post, that is the key point.

                      To reproduce, although the screenshots kind of prove the point, do a load of limit entries, one contract, exit an hour later, and make sure limit prices are not on a tick boundary. I don't know if it matters, but it's an unmnanaged strategy.

                      Comment


                        #12
                        Furthermore did some more research on the fill type:

                        else if (order.OrderType == OrderType.Limit)
                        {
                        // Orders are filled when traded through the limit price not at the limit price
                        double nextLow = NextLow;
                        double nextHigh = NextHigh;
                        if ((order.OrderAction == Cbi.OrderAction.Buy && order.LimitPrice > nextLow + epsilon)
                        || (order.OrderAction == Cbi.OrderAction.BuyToCover && order.LimitPrice > nextLow + epsilon)
                        || (order.OrderAction == Cbi.OrderAction.Sell && order.LimitPrice < nextHigh - epsilon)
                        || (order.OrderAction == Cbi.OrderAction.SellShort && order.LimitPrice < nextHigh - epsilon))
                        FillPrice = order.LimitPrice; // set fill price

                        }


                        You can see here that FillPrice = order.LimitPrice in some scenarios. If you feed it a limit price that is not valid it will cause the fill to fill at that price on backtests. You would need to use Instrument.Round2TickSize() on your limit order submits to make sure you are submitting them at the correct limit price.

                        -Brett
                        BrettNinjaTrader Product Management

                        Comment


                          #13
                          Brett,

                          I think you're missing the point. The fill price is correct, as shown on the executions. This is what you would expect the sim engine to do - to fill at a price that can exist. The wrong fill price is then assigned to the order, and that wrong fill price is then used on the order tab and the trades tab so making the P&L incorrect.

                          It's rather worrying that those values aren't assigned correctly - it doesn't look very robust to me.

                          Comment


                            #14
                            Thanks for the feedback.

                            Sent into development.

                            -Brett
                            BrettNinjaTrader Product Management

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by bomanpbm, Today, 09:27 PM
                            0 responses
                            1 view
                            0 likes
                            Last Post bomanpbm  
                            Started by tgn55, Today, 08:47 AM
                            0 responses
                            8 views
                            0 likes
                            Last Post tgn55
                            by tgn55
                             
                            Started by ballboy11, 05-04-2019, 10:26 AM
                            6 responses
                            58 views
                            0 likes
                            Last Post Kermit
                            by Kermit
                             
                            Started by mrlucky1x, Yesterday, 10:01 PM
                            0 responses
                            15 views
                            0 likes
                            Last Post mrlucky1x  
                            Started by roger556, Yesterday, 09:22 PM
                            0 responses
                            8 views
                            0 likes
                            Last Post roger556  
                            Working...
                            X