• 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

Millisecond precision

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

    Millisecond precision

    Hello, guys! Is it possible to create trade system in Ninja which will react precisionly to millisecond?

    #2
    Hello U0000999,

    Thanks for your post.

    Your strategy code, when set to Calculate.OnEachTick, would run as each tick is received. If you look at the Historical data you can see the time stamps of ticks in the format of Hours:Minutes:seconds:milliseconds. I've attached a screenshot of the ES 09-19 for July 5th. As you can see in the example several ticks have the same timestamp (means that they had a less than 1 millisecond difference)and each tick would cause your code to run (if set to Calculate.OnEachTick). You can also see that at 9:32:59:335, the next tick did not occur until 9:32:59:943 which would be 608 milliseconds later.

    So your code would execute as fast as your PC will calculate it, however when considering a "system", while the code executes extremely fast (based on your PC) actual live trades depend on the asynchronous process of order transmission, exchange/broker receiving, order filling and transmitting back the order status and data. Depending on your internet connection, this could be many milliseconds to hundred of milliseconds, So unless you are using a Virtual Private Server at an actual exchange, the filling of orders would not happen as quickly as your PC processes each tick.

    Click image for larger version

Name:	u0000999-1.PNG
Views:	1
Size:	67.0 KB
ID:	1064492
    Last edited by NinjaTrader_PaulH; 07-18-2019, 11:11 AM. Reason: Forgot to attach screenshot.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      I use dedicated cloud 16 cores, 64 GB RAM, I think, it's enough. But in reality it makes slippage.

      Comment


        #4
        Hello U0000999,

        Thanks for your reply.

        I think this is the germane comment, "So unless you are using a Virtual Private Server at an actual exchange, the filling of orders would not happen as quickly as your PC processes each tick."
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          what will be the decision?

          Comment


            #6
            Collocate server directly on Exchange .... or?

            Comment


              #7
              Hello U0000999,

              Thanks for your replies.

              I would not be able to advise regarding what would be the best scenario for you regarding VPS (Virtual Private Server) and recommend that you research the topic on your own through various VPS vendors

              It terms of the platform, as discussed the OnBarUpdate() method is an event driven (run on incoming tick) method. If you wanted to do something with a timer after x milliseconds, you could take a look at the example code in SampleCustomEvents here: https://ninjatrader.com/support/help...to_output_.htm
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                May be to make better solution: understand what's the real delay in real trading, and programm trade system according to this delay? If I know that I have stable delay 50ms, I may create code, which activates system with 50ms before ending close of a candle? It's just an idea....

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Newtrader101, Today, 03:54 PM
                1 response
                15 views
                0 likes
                Last Post NinjaTrader_ShawnB  
                Started by williamzz, Today, 03:28 PM
                0 responses
                7 views
                0 likes
                Last Post williamzz  
                Started by Robert87, Today, 11:07 AM
                0 responses
                14 views
                0 likes
                Last Post Robert87  
                Started by phta123, Today, 10:24 AM
                0 responses
                17 views
                0 likes
                Last Post phta123
                by phta123
                 
                Started by sidviciousX, Today, 06:47 AM
                0 responses
                16 views
                0 likes
                Last Post sidviciousX  
                Working...
                X