Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Would Getting a Server near the Exchange Help?

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

    Would Getting a Server near the Exchange Help?

    Good Morning,

    I have an interesting question regarding the statistics that are obtained using various settings in NinjaTrader. I have enclosed a sample code so that others may see this phenomena. It uses random entries for longs and shorts based on a random number generator and a limit 2 ticks below the close of the last bar.

    Here are the statistics it hits: When enforce Immediate fills is checked it hits around 58% - 62% wins in any time frame in any market, when enforce immediate fills is not checked it shaves off almost only winners and the statistics hit around 42% to 48%.

    I would assume that flipping a coin using a code such as this you would typically be at 50% / 50% either way so my initial question was why is such a huge discrepancy in the fill algorithm... Then after doing some digging I came to understand that NT is trying to simulate latency and compensate for less than optimal fills, so un-checking the box will hurt more than help.

    So here is my question: This NT fill algorithm must baseline the odds of getting fills at some sort of universal average so it's not overstating what a guy in Australia would achieve, but at the same time this may be understating what a guy in Chicago trading the ES would get. Since there is no way to pick your location, a global average fill approach would beat down the statistics for traders closer to the exchange to offset fills for those trading far away. I found the following post where a guy bought a server near the exchange in Chicago and claims to get nearly perfect limit fills. This would imply that (enforce immediate fills = true) may be more in line with traders close to the exchange, while unchecked may be more in line with traders far away. Take a look at the link below.... I am skeptical of course, but I do wonder if there is any merit in this.


    What is hilarious here ? What @Fat Tails ( is writing is that the best delay might be 67ms + few ms for each router (15 hops for me from France for example). No QoS involved here, 67ms + (hops count * 1.5ms) is maybe the best you can have, whatever the protocol used. I don't see what's wrong here... what is hilarious is all the "science" behind it, as if it really makes that much of a difference, that he is quoting... I never said that something was wrong, let's not put words into my statement, …


    I don't know if anyone has any experience with this, or if there is far more to it than just proximity, but I think it would be interesting to get feedback on the following:

    A: Why such a huge difference running this code both ways. (Checked / Unchecked)
    B: Would being closer to the exchange help to hit statistics closer to checked vs. unchecked?
    C: Are there other factors outside of proximity to the exchange / getting in the que quicker that would impact / nullify limits from getting higher fill rates that the algorythm is trying to compensate for?

    Any advise or opinions from the technical team or other traders are welcome.

    Thanks,

    Ian

    #2
    Strategy Attached
    Attached Files

    Comment


      #3
      Hi iantg,

      The Default vs Liberal fill type causes an order either fill when the price passes through the trade with the default or fill when touched with the liberal. This done by using the prices of the historical data.

      Any statics would be correlated based on when the order fills. (It is not random, but is predictable with the data)

      Below is a link to the help guide on Backtesting a Strategy. Please see the section 'Understanding historical processing options'.
      http://ninjatrader.com/support/helpG...a_strategy.htm


      Would you like to submit a feature request to create a fill algorithm that allows for a simulated distance from exchange input?

      Would you have any input on how this would work?

      For example, this could require intra-bar granularity of 1 tick be added to the script, and require that several ticks be on the opposite side of the order, with the higher the simulated distance set in the input the more ticks are required on the opposite side of the order for the order to fill.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Chelsea,

        Thank you for your quick feedback. I think it would be very interesting and very helpful to understand the relationship between limit fills and distance to the exchange if this in fact a correlated factor. From the perspective of just an agnostic data scientist here are my observations and obvious questions:

        In market replay I have back tested 2 years and using nothing more than random entries I hit 60% winners when enforce immediate fills is checked, when unchecked this diminishes down to around 45% winners. So there is obviously some bias toward shaving off winners more than losers when unchecked. I am guess that price touch favors winners and price pass through favors losers.

        So as someone that is backtesting I see two extremes on different ends of the spectrum. I doubt that using a resting limit 2 ticks from the price you would always need price pass through, but at the same time I doubt you would get filled 100% with price touch. So my thinking is that the truth my lie somewhere in the middle of these two extremes. As I mentioned in my first post, a trader got a server in Chicago and claimed he improved his limit fills dramatically, so I am stuck here between wondering if getting closer to the exchange would lead a simple random entry system to the optimistic (60% winners using enforce immediate fills or the 45% winners using unchecked). You can see my delima... i just don't know which would be real in real markets, so i would love some feedback and opinions.

        Regarding your proposal of simulating fills based on proximity to the exchange. Yes please! Though I am not sure exactly how the sliding scale would work on this, I think this would be a great value added service to all the paper trades, because I would guess the real world is not as simple as (price touch vs. price passthrough) and it would be in line with one more than the other based on proximity to the exchange as one factor.

        Thanks,

        Ian

        Comment


          #5
          One more thing to point out: I am using the market replay for backtesting not using the strategy analyzer. So I am not really talking about the (Liberal vs. Default) fill type that only applies to the strategy analyzer, I am referring to the Enforce Immediate fills (Checked or unchecked) in market replay. This may or may not be the exact same thing, I am unsure.

          Comment


            #6
            Hi iantg,

            The Fill Types are not involved at all when it comes to real time orders made on the market or any Sim101 trades with real-time data. These will all use the simulation engine to fill orders.

            The simulation engine uses volume to simulate fills. Checking the Enforce Immediate Fills will cause the simulation to ignore the volume and fill immediately.

            While someone closer to the exchange will have their orders received sooner, this does not negate the fact that they will still be in line.

            Instead of a feature request to change the fill algorithm, would you like to submit a feature request to change the simulation engine to allow for a set delay?
            Last edited by NinjaTrader_ChelseaB; 02-12-2016, 01:50 PM.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Chelsea,

              Thank you for your feedback this is very helpful. So I have two follow up questions then.

              1. Does the Simulation Engine that fills the orders differentiate between limit types? For example does it have any concept a resting limit order placed 4 ticks away from the price 4 bars ago vs. a non resting GetCurrentBid with respect to what would be in the proverbial line first? I would think a resting limit placed slightly away from the action would be 2 to 3 times more likely to get filled vs. asking for the best price now, for example.

              2. Does Unchecking the enforce immediate fills force every limit that gets filled to have price pass-through or will it ever still fill on price touch? I wasn't sure if checked = price touch and unchecked = price pass-through.

              So my request for the developers would be: If the answer to #1 is no, there is no differentiating between limit orders in the que, I'd like to see some way to reward a longer resting limit with a more immediate fill and and either ignore current bar GetCurrentBid type limits or force price pass-through. I am not 100% sure what is in place, but to me the real market would treat each of these differently.

              The other request might be to simulate success of limit fills and or require price touch or pass through based on proximity to the exchange as one factor. I know this is only one part of it, but I think it would be nice to see the impact. So I suppose a set delay as you mentioned would be helpful.

              Thanks,

              Ian

              Comment


                #8
                Hello iantg,

                Yes, the simulation engine will only use level 1 information to fill an order. This means the limit or stop must be at the bid or ask and must have volume at the bid or ask to fill the order. Enforcing immediate fills will no longer use the volume and simulated place in line and will fill immediately.

                In a real world situation, you can be filled at any price if someone places an opposing trade right at your price (no matter how far away that may be). Your order would be part of the level 2 information as its working, the opposing trade (if placed right at your price) would not. When the trade happens this becomes a last tick.

                No, un-checking Enforce immediate fills does not require a pass through. Instead, this uses a place in line and volume to fill the order. The pass through is only required of historical trades with historical data and when the fill type is set to Default.

                Please let me know if this changes your request.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Chelsea,

                  Thank you for clarifying this for me. So if the current simulation engine does use some logic to simulate your place in the cue, I imagine that you would see the following, can you please confirm:

                  Scenario 1: In a fast moving market I place an a GetCurrentBid limit order. I do this right on top of the current price after the last bar closes.

                  Scenario 2: In a fast moving market I place a resting limit order 10 ticks away from the current price and therefore may get a spot in line early using something like: EnterLongLimit(0, true, 1, Close[0]-10, "Long Entry"); I keep the trade open for lets say 20 bars before the code cancels the order and try' again for another resting limit.

                  So if the simulator has any concept of who got in line first, in scenario 1 I would not get filled because i placed an order to late, whereas in scenario 2 I would get filled because I placed a resting limit and was at the front of the line. Does the simulation engine have the ability to treat these two cases differently?

                  With respect to Liberal vs. Default, just to be clear: Liberal = price touch, and Default = price passthrough and I can run these scenarios for both enforce immediate fills (checked vs. unchecked) So in actuality there would be 4 different types of simulation outcomes you could see right?

                  1. Default + Enforce Immediate Filled unchecked: Most challenging
                  2. Default + Enforce Immediate Fills checked: Moderately challenging
                  3. Liberal + Enforce Immediate Fills unchecked: Easiest
                  4. Default + Enforce Immediate Fills checked: Slightly challenging

                  Maybe this is just my take on the trading environments, but just to confirm, there are 4 possible trading environments to simulate? So now the million dollar question, do you think that any of these 4 settings would be a good proxy for different real world trading environments? Say very liquid market + Trading close to exchange may be 3 or 4 and a very illiquid market on the other side of the globe from the exchange may be 1 or 2?

                  Thanks for your feedback!

                  Ian

                  Comment


                    #10
                    I have no problem in ES with market fills. .25 off isn't going to hurt since I'm achieving my targets with pass through. Which has surprised me, I figured I'd be off a tick or 2 when target fills.

                    Stop losses are probably a little different, usually the market is heading the opposite way very fast(especially when no buyers are around), and I lose a little more than in replay.

                    I'm not playing for 1 point, so I'm fine with my connection so far in east coast usa.

                    Those guys in Europe are really hurting in fast markets. There are several posts complaining nt can't handle it, but it's really their connection. I've only seen 15 seconds lag during fomc news. (I don't pay during this time).

                    Comment


                      #11
                      Thank you Sledge for your feedback. Could you tell me a little bit more about your trading parameters just so I can try to make an apples to apples comparison to what I am attempting to do. I am currently using the ES as well, but I am using limit orders as entries with profit targets / stop losses somewhere around the 5 to 15 tick mark depending on a few things. My main question to fellow traders is: If I bought a server in Chicago and used resting limits to try to get in line earlier would I have any shot at getting close to the immediate fills that one can achieve in backtesting if enforce immediate fills is checked. I enclosed a sample code that just takes random entries and with the box checked you have 60% winners and with the box unchecked you have around 45% winners. So my obvious question is: If I was in Chicago near the exchange and I used resting limits to try to get to the front of the line, could I get filled more in line with (Immediate vs. Unchecked).

                      Thanks for you input.

                      Comment


                        #12
                        Hello iantg,

                        Are you asking about historical trades or real-time trades?
                        These do not fill the same way.

                        If you are asking about your place in line, this would only involve real-time trades, as historical trades do not use a place in line.

                        The fill type (default or liberal) is utilized when backtesting historical data, but is not utilized for real-time trades.

                        The simulation engine is utilized when simulating real-time fills to the Sim101 or MarketReplay Replay101 accounts, but is not utilized when backtesting historical data.

                        In your senarios, I am unsure of why NinjaTrader or a live exchange would treat any orders differently. If you place a sell limit order (sell orders fill with some else's bid, buy orders fill with some's ask) and this is at the bid price, if there is enough volume the simulation engine will fill the order. If there is not enough volume the order will not fill. When the limit is placed, you will be at the back of the line of orders sitting and working at that price, no matter what price level you place the order at (including if this is the current bid price). In other words, if you place the order at the bid price, you will still be at the back of the line. If you place the order at a different price, you will still be at the back of the line.

                        When backtesting the order will fill if the order is between the high and low of that bar (with the default fill type the price has to be at least one tick past the order) and your place in line has nothing to do this.

                        Again the fill types affect historical trades and not real-time trades. Yes, the default requires a pass through when backtesting. The liberal fill type will fill on touch, when backtesting.


                        Enforce immediate fills affect real-time orders.
                        Fill types such as Default / Liberal affect historical orders.

                        I am unsure of how to address your inquiry. No, there are not 4 types of simulation outcomes.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Chelsea,

                          Thank you for your expertise on this subject. For context purposes, I am only referring to using market replay with downloaded data from kinetic. I am not referring to back-testing the strategy analyzer. I know there are some options that are available in strategy analyzer back-testing that are not available in market replay simulation and vice versa. Perhaps I misunderstood but If I run a simulation in market replay can I not run it with the following options: (Fill Types A: Default, or B: Liberal) Maybe this is only available in strategy analyzer back-testing and not market replay. I know in market replay I can check or unchecked the Immediate fill option, so if I combined these with the liberal / default this is where I got my 4 permutations total. I have never got the liberal vs. default fill types to behave any differently on market replay, so I am now guessing this is only an option for strategy analyzer.

                          Regarding my question about simulating your place in the cue... here is my thinking. Hypothetically If 90 people are using on bar update to set limit orders, then each bar update users are submitting new limit orders and going to the back of the line. But if 10 people were using resting limit orders, (say for example they stay alive for 10 bars then if not met, are replaced) Someone that placed there order 5 bars ago would be in line ahead of someone that placed their order 1 bar ago. So if there were only 10 limit orders available the 10 people with resting limit orders would get them because they were in line first. This is the type of dynamic I was referring to. Obviously there is more complexity beyond just having your place in line that determine if you get filled first, but I was just curious if NinjaTrader had any logic in the fill algorythm to favor resting limits in this type of scenario.

                          As far as my wish list for development features that would be helpful: I would like to see the impact of how different resting limits would impact my success rate at getting on the right side of some of the fast moving trades. My assumption is that if only 10% of the market could get filled on some of these fast moving situations what would it take to get in the 10%? Is this a resting limit that was placed 5 bars ago, 10 bars ago, etc. If most of the market is just dropping limits on current bar updates trying to be right on top of the price, I have to believe that someone that asked for that price 10 bars ago when the market was no where near that price at that time would be able to get filled first. Does this make sense or is my line of thinking way off?

                          Ian

                          Comment


                            #14
                            Hello Ian,

                            First, I want to confirm if you are understanding the difference between real-time data and historical data.

                            When you first open a chart the chart should have data already on it. That data is data from the past and is historical data. This is cached to your local computer and called anytime you want to back fill a chart.

                            When a strategy is added to a chart, it will first process the historical data. This is a backtest. The trades made here are historical trades and are the same trades that would appear if you backtest a strategy in the Strategy Analyzer using the same settings and same amount of data.

                            After the strategy has processed the historical data on a chart, the Historical bool will change from true to false and the strategy will start running in real-time.

                            The fill types (Default and Liberal) only apply to historical trades, backtest trades, on either a charts historical data or in the Strategy Analyzer. This is the algorithm that dictates how the order will fill historically.

                            Please look at the following document that I have suggested in post #3 on "Understanding historical processing options" under the heading "Historical Fill Processing".
                            http://ninjatrader.com/support/helpG...a_strategy.htm

                            Also, should have a look at the following document, Discrepancies Real-time vs Backtest.
                            http://ninjatrader.com/support/helpG...ime_vs_bac.htm

                            In real-time, the fills are not based on the historical fill processing, instead these are volume based fills that simulate a hypothetical place in line based on the amount of volume at that price before your order was received and became working.This is done with a real-time simulation engine which does work different than backtesting with historical data on a chart or in the Strategy Analyzer.

                            The Market Replay will play back data as if it were live. NinjaTrader treats the playback of replay the same as live data and the simulation will process the same.
                            However, on a chart there will be historical data first, and then real-time data after.

                            Yes, placing an order before someone else does put you in front of them in the line.

                            Your further questions are directed about creating logic of a strategy to place your trades before others and I cannot assist with this logic. However, this thread will remain open to any community members that would like to assist.

                            I am not understanding your feature request. Can you specifically state what you would like changed without explaining how this would help you?
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Chelsea,

                              Thanks for your prompt response. We are on the same page with the differences between back-testing with the strategy analyzer and using market replay. I use market replay and typically run 3 months at a time in 500X speed over the course of several hours to see my results.

                              Regarding the feature request (Or to clarify my understanding if this already exists in the simulation engine).
                              What I am looking for is a way to simulate how different resting limit orders or resting stop orders may end up closer to the front of the line to get filled. For example my understanding is that if volume is thin at a specific price (There are 20 sellers but 100 buyers). So only 20 buyers would get filled the other 80 don't. In the real market my assumption is that these 100 buyers would arrive something to the effect of this example:

                              10 buyers: 5 to 10 bars ago placed their order (Front of the line)
                              20 buyers 3 to 4 bars ago placed their order (Middle of the line)
                              70 buyers 1 bar ago placed their order (Back of the line)

                              With the current NT simulation, it might say if there are 20 sellers and 100 buyers at a price, then don't fill because the odds are 80% against you. And this makes perfect since and I assume this is the way it works currently.

                              What would be nice to see is some sort of probability weighted adjustment based on when you got in the cue. So in the above example if I placed a resting limit 10 bars ago I would have a much higher probability of getting one of the 20 orders because I would be in the front of the proverbial line.

                              The complexity of something like this may be too much trouble as it would likely require level 2 data, and it might slow processing speeds down to the point that it would run too slow. But I think it might be neat if users could just turn this feature on or off.

                              Does this explain the scope of the idea and is there any merit in this thinking at all?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by cre8able, Today, 03:20 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post cre8able  
                              Started by Fran888, 02-16-2024, 10:48 AM
                              3 responses
                              47 views
                              0 likes
                              Last Post Sam2515
                              by Sam2515
                               
                              Started by martin70, 03-24-2023, 04:58 AM
                              15 responses
                              114 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by The_Sec, Today, 02:29 PM
                              1 response
                              8 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              2 responses
                              32 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Working...
                              X