Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit order execution price in simulator

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

    Limit order execution price in simulator

    I'm testing a strategy on the simulator which uses limit orders only. Occasionally executions appear at the wrong price.

    If, for example, the TF is trading around 651.0 / 651.2 and I have a buy limit order placed at 650.8. If there's a sudden jump down in the price, the simulator fills my limit order too low. Say the trades on the tape go 651.2 - 651.0 - 650.5 then the simulator will fill me at 650.5, whereas in reality I'd get filled at 650.8.

    Is there any way to correct for this?

    #2
    Hello Mooney,

    The NinjaTrader simulation engine is designed to operate as realistically as possible, but you can decrease this type of slippage by enforcing immediate fills in the account. Please take the following steps:
    • From the Control Center, click Tools > Options to open the options menu.
    • In the Options menu, navigate to the Simulator tab.
    • In the simulator tab of the options menu, check the box labeled 'Enforce Immediate Fills'.
    • Click OK to exit the options menu for the change to be applied.

    Please let me know if there is anything else I can do for you.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Hi Matthew - many thanks for your quick reply. Apologies, but I don't think I've got my point across. This isn't slippage - it's the opposite.

      In my experience the simulator engine does a really great job of estimating fills. I've run live 1-minute bar strategies side-by-side with simulated ones and been impressed at how accurate the simulator is. For that reason I always test with immediate fills turned off.

      However, this is a different problem.

      If I place a limit order in the market, I will never get filled at better than the limit price. The simulator is filling me at a better price than the limit. That's because the real market (without my simulated order) didn't trade at my limit price, but straight through it.

      I think this may be a slight bug in the programming of the simulator, but I'm just looking for a workaround if possible.

      Comment


        #4
        Mooney,

        Sorry for the confusion on terminology as slippage would be impossible on a limit order - while it might not technically be 'slippage' that you get with a stop order, it is possible for the simulator to fill your limit order at a 'better' price' if it trades through it depending on a number of market factors. For example:
        • On gap down bars, buy limit orders can fill at the high of the gap down bar
        • On gap up bars, sell limit orders can fill at the low of the gap up bar


        So you are saying enabling this option does not change the behavior you are experiencing?
        MatthewNinjaTrader Product Management

        Comment


          #5
          On gap down bars, buy limit orders can fill at the high of the gap down bar
          On gap up bars, sell limit orders can fill at the low of the gap up bar
          That's true in the simulator, but for most markets (certainly every one I'm familiar with) if you place a limit order in the market at better than the current market price, you will never get filled at better than that limit. This isn't a probability, "in my experience" thing - it's the GLOBEX market rules. If I have a limit order sitting in the order book and somebody enters either a market or limit order which crosses mine, then my limit level is the price we trade at.

          I haven't tried Enforce Immediate Fills, because it would cause huge problems with unrealistic fills. As you know, limit orders frequently don't get filled even if the market trades at that level, especially in the instruments with thick books. Even if it solves this glitch, the other problems it would create would be far, far worse.

          What I'd like to do in my code is enforce trading at the limit price even if the simulator thinks (incorrectly in my view) I should have got better. Think of it as a more conservative assumption I'd like to make in testing the strategy. Can you give me a hand here - is there any way of doing that?
          Last edited by Mooney; 09-30-2011, 08:11 AM.

          Comment


            #6
            Mooney,

            Unfortunately, there would not be away to change the way the simulator behaves in this regard.
            MatthewNinjaTrader Product Management

            Comment


              #7
              Damn! It's a shame you can't change it in the OnExecution script or something.

              Any chance of suggesting it as an enhancement? It would be nice to just have a check-box to force limit orders to execute no better than the limit price. Even if there are cases where you might get a better execution, this is a more conservative assumption which may be preferable for paper trading.

              Very many thanks indeed for your patience Matthew. It may not be the answer I wanted, but your help is much appreciated all the same.

              Kind regards,
              David

              Comment


                #8
                David,

                I have submitted your suggestion for the enhancement of NinjaTrader to our development team and it has been assigned the unique tracking ID # 1307. We appreciate your commitment in helping us to improve NinjaTrader.
                MatthewNinjaTrader Product Management

                Comment


                  #9
                  In case it helps, I was running the sim against a real-life account this morning and saw a few instances of the problem. It may help to show that this isn't a rare theoretical problem with the simulator. It does affect real-time paper trading results significantly.

                  Click image for larger version

Name:	SimVsReal.jpg
Views:	1
Size:	204.4 KB
ID:	862693

                  Comment


                    #10
                    David -

                    Are you saying the issue you are dealing with has an impact on the actual dollars you are placing at risk in your live account?
                    The reason I ask is because I have noticed again this morning that if I scale up or down in sim trading it is possible to end up with a 1 k holding that reflects half the value of an ES tick. I.e,, .25 is shown as $6.25 and subsequent moves reflect half the normal value of a tick.
                    My first impression is that the sale of 1k should not devalue subsequent ticks of a remaining k.

                    Thanks for your reponse.

                    Comment


                      #11
                      No - that sounds like something different.

                      Comment


                        #12
                        Right, I understand you are dealing with a "fill" issue and the issue I raise concerns proper calculation of the movement of a fill.

                        Frankly, I misread your "It does affect real-time paper trading results significantly." and believed you were saying the issue resulted in incorrect info being sent to your broker.

                        Never mind. (insert happy face here)

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        655 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        370 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        109 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        574 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        577 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X