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:	438
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 maybeimnotrader, Today, 05:46 PM
                0 responses
                5 views
                0 likes
                Last Post maybeimnotrader  
                Started by quantismo, Today, 05:13 PM
                0 responses
                6 views
                0 likes
                Last Post quantismo  
                Started by AttiM, 02-14-2024, 05:20 PM
                8 responses
                166 views
                0 likes
                Last Post jeronymite  
                Started by cre8able, Today, 04:22 PM
                0 responses
                8 views
                0 likes
                Last Post cre8able  
                Started by RichStudent, Today, 04:21 PM
                0 responses
                5 views
                0 likes
                Last Post RichStudent  
                Working...
                X