Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Difference Live data - simulation

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

    Difference Live data - simulation

    Hi support!

    I always have differences when comparing live/playback executions to executions of a simulation.

    The current example/issue is a BUY LIMIT (to cover) order.

    In live/playback modus the order is executed at the bid price as soon as the bid price is hit. In a simulation, the order is NOT executed when the bid price is hit.

    The simulation is doing it right because you need an ask price at the level of your "buy limit" order, in order to get a execution - a bid price alone does not guarantee an execution.

    Example today:
    currency pair GBP/USD
    Buy Limit 1,6040
    Filled at 8:46:31 in live/playback modus but not in simulation
    Lowest Bid/Ask at 8:46:31: 1,6040/1,6041

    I really hope you can clarify this.
    Thank you,
    DH

    #2
    Hello,

    Can you please clarify what you mean by simulation and how you are comparing them.

    Also what speed are you running the replay data at. Also, is the order submitted by hand and your just watching it or is this submitted with a NinjaScript strategy?

    So if i understand correctly your saying that market replay is filling order long with the bid hits the limit order price and not the ask? Or is the ask hitting the price and its just filling faster then it did before. In this case would be expected since the simulator fills randomly.

    Also, the other difference here is if you have level 2 data availiable in the market replay. Sounds like you may not as this behaivior would also be expected if your just running on level 1 data during replay. Can you please right click on the market replay slider and let me know if you have level 2 data for this time and date you found this to be true for.

    I look forward to assisting you further.


    I look forward to assisting you further.

    Comment


      #3
      Hello Brett,
      thanks for your fast response!

      Originally posted by NinjaTrader_Brett View Post
      Hello,

      Can you please clarify what you mean by simulation and how you are comparing them.
      By simulation I mean running a strategy on a chart at a later time or using the strategy analysier.

      Also what speed are you running the replay data at. Also, is the order submitted by hand and your just watching it or is this submitted with a NinjaScript strategy?
      Replay at normal speed.
      For the replay, I had to submit the order by hand because I had not enaugh replay data to run my strategy.

      So if i understand correctly your saying that market replay is filling order long with the bid hits the limit order price and not the ask? Or is the ask hitting the price and its just filling faster then it did before. In this case would be expected since the simulator fills randomly.
      In live mode, the bid hits the limit price but not the ask and the order gets filled.

      "the simulator fills randomly"
      What does this mean? what are the rules here?

      Also, the other difference here is if you have level 2 data availiable in the market replay. Sounds like you may not as this behaivior would also be expected if your just running on level 1 data during replay. Can you please right click on the market replay slider and let me know if you have level 2 data for this time and date you found this to be true for.
      I am more concerned about the live mode! I just did a test in replay mode to see if it is doing the same as in live mode.
      In replay mode I only have level 1 data, I don't know why, I should have level 2 data as well. But, does it matter?

      Thanks, DH

      Comment


        #4
        Hello,

        On Market Replay level 2 data would be needed to let the simulator fill better. As far as the specifics of how the simulator works is not detailed in the help guide. Essentially it does its best to simulate market conditions and real market fills. It will partfill and calculate probability of getting filled based off the volume and ask and bid price. Which would require level 2 data to run.

        As far as comparing live test results to the strategy analyzer test results this document will clear everything up for you.

        Essentialy this is expected:



        Let me know if I can be of further assistance.

        Comment


          #5
          Brett,
          I read the real-time vs backtest documentation of NT-7. Anyway, the behaviour is a bit strange.

          I am running a strategy in NT with live date from IB. I enter the orders manually in IB, there is no broker connection. This is to test the behaviour of NT compared to different brokers of my clients. Most of them have a NT - broker connection, some not, they only use the signals generated by NT, and they are confused.

          I am testing this since quiet a while now, and it's always the same:
          In live mode, when the bid price of a buy limit order is hit, NT gets a fill but in real life you will almost never get a fill at this price.

          In backtest this works fine, but in my point of view, the live mode generates wrong fills.

          Thank you
          DH

          Comment


            #6
            Hello,

            In a backtest there is no consideration for the bid or ask price. Only when running live. In which case in my test is I place an order on the simulator. It does not get filled until the ask price hits it. This should be working as expected let me know if I'm off here?

            In any reguard the simulator simply does its best to replicate market conditions. You cannot count on the simulator to exactly like live trading.

            Let me know if I can be of further assistance.

            Comment


              #7
              Originally posted by NinjaTrader_Brett View Post
              Hello,

              In a backtest there is no consideration for the bid or ask price. Only when running live.
              Well, I am running a backtest on a 1 min chart with a buy limit order at 1.6040. The chart is based on 1 min bid prices. The bid price hits 1.6040 but the buy limit order was not filled!
              If in backtest there is no consideration for the bid or ask price, the order had to get filled.

              In which case in my test is I place an order on the simulator. It does not get filled until the ask price hits it. This should be working as expected let me know if I'm off here?
              In live mode, the order gets filled at the bid price, no mater where the ask price is!

              Thanks,
              DH

              Comment


                #8
                Hello,

                Correct however it must run on one type. You either choose to run it on just the bid price, just the ask price, or just the last price. It does not run on both like it would in realtime.

                Please see the below video. Hope this clears it up for you. You will clearly see in the video even though its a little fast you can pause it though. You will see the bid hits the limit order price however it does not fill until the ask price hits it.

                Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


                Vice versa for a short position.

                Let me know if I can be of further assistance.

                Comment


                  #9
                  Brett,
                  thank you for your effort doing the video.

                  I tested the DOM as well and it is behaving as expected. However, if you run a strategy in live mode it does not behave that way, it will buy at the bid price - that's the problem.

                  regards,
                  DH

                  Comment


                    #10
                    Hello,

                    Understood.

                    When you start the strategy what are you starting the strategy with Price Based on setting.

                    Also please let me know what line of code specifically you are using to enter your positions.

                    I look forward to assisting you further.

                    Comment


                      #11
                      Price based on: Last (looks like it is the same as price based on bid)
                      Type: Minute
                      Value:1

                      The buy limit order to cover:
                      orderShort1Target = SubmitOrder(0,OrderAction.BuyToCover,OrderType.Limit,order.Fill ed,Short1Target,0,OCO + "SHORT-1","SHORT-1-TARGET");

                      Comment


                        #12
                        For my understanding, please clarify ...

                        Originally posted by DH008 View Post
                        Hi support!

                        I always have differences when comparing live/playback executions to executions of a simulation.

                        The current example/issue is a BUY LIMIT (to cover) order.

                        In live/playback modus the order is executed at the bid price as soon as the bid price is hit. In a simulation, the order is NOT executed when the bid price is hit.

                        The simulation is doing it right because you need an ask price at the level of your "buy limit" order, in order to get a execution - a bid price alone does not guarantee an execution.

                        Example today:
                        currency pair GBP/USD
                        Buy Limit 1,6040
                        Filled at 8:46:31 in live/playback modus but not in simulation
                        Lowest Bid/Ask at 8:46:31: 1,6040/1,6041

                        I really hope you can clarify this.
                        Thank you,
                        DH
                        DH008, i am a futures trader and I would like to understand your question better for my own benefit. Going all the way back to the beginning, I don't see any problem with your example shown. In the live market, your limit order at 1,6040 was matched again a random market order in the live market. In your case it appears to me that a sell market order was matched against your standing limit order at 1,6040. The fact that the bid / ask was 1,6040/1,6041 just confirms that you were in the queue attempting to buy at 1,6040 and your turn came up and you grabbed the next market order. As such, this is my understanding of the live market and your examples of mostly or always getting the bid price on your buy limit orders is consistent with how the live market should behave.

                        Since you are in fact getting the better price for your buy and the live mkt supports this frequently, I don't understand why there is a problem here.

                        Comment


                          #13
                          YanCanCook,
                          welocme to the discussion, nice that you join in.

                          I am trading futures as well but in this case I am talking about the forex spot market. Anyway, the same rules are true for the futures market.

                          If you have a buy limit order at x.x and the lowest ask price is higher then x.xx, in most cases you will not get filled. The problem is, if you run a strategy in live mode NT will ALWAYS get a fill at the bid price, even the ask price never matches your buy price.
                          DH
                          Last edited by DH008; 11-02-2010, 02:37 PM.

                          Comment


                            #14
                            Brett, are you still working on this issue?
                            Thank you,
                            DH

                            Comment


                              #15
                              Hello,

                              This ticket was closed by a co-worker of ine so I was not looking into the issue further thanks for bringing it back up.

                              How do you know the trade is executing on the bid or the ask price? What line of code are you using to verify this out to the output window?

                              Also, What line of code are you using to enter your positions.

                              Are you using EnterLong()

                              or Unmanaged approach if unmanaged please paste the line out of your code your using to submit the order.

                              I look forward to assisting you further.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by bortz, 11-06-2023, 08:04 AM
                              47 responses
                              1,606 views
                              0 likes
                              Last Post aligator  
                              Started by jaybedreamin, Today, 05:56 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post jaybedreamin  
                              Started by DJ888, 04-16-2024, 06:09 PM
                              6 responses
                              18 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by Jon17, Today, 04:33 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post Jon17
                              by Jon17
                               
                              Started by Javierw.ok, Today, 04:12 PM
                              0 responses
                              13 views
                              0 likes
                              Last Post Javierw.ok  
                              Working...
                              X