Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90


Optimizing processing time in milliseconds

  • Filter
  • Time
  • Show
Clear All
new posts

    Optimizing processing time in milliseconds

    Hi Ninjas

    NT platform does a great job running automated algoritms pretty fast, however I'm interested to optimize that process a little bit in my code, so a doubt rises for incoming tick by tick frame. Let's suppose that you have a decent internet connection, working with IB, a very fast PC and your strategy is working tick by tick:

    1. Approximately: how long ( in milliseconds ) does NT take for the whole process: from "Market Order signal triggered" until "Order filled received", meaning the complete round ? 100, 150, 200 milliseconds?

    2. If your Strategy triggered a new opposite order BEFORE that the last market order has been filled, will that situation create an overfill ?

    3. Which way could it be a faster code to process a comparison between variables :
    a) Using conditional sentences such as: IF .....THEN
    b) Substituting conditional sentences by a simple equation that has the same logic ?

    I'm pretty aware that NT is far from processing HFT algos but I'm trying to do my best.

    Thanks for your attention
    Last edited by pstrusi; 10-05-2016, 04:16 AM.

    Hello pstrusi,

    Order submissions are not timed. The amount of time it will take for the order to come back as accepted and then working depends on your internet speed and your computer speed.

    The faster your processor is, the faster orders can be prepared and submitted. The faster your internet and the closer your location to the servers of your broker, the faster order information can be transmitted and received.

    An overfill occurs if an order cancellation or order modification is sent and the order has already been filled or cancelled.

    Your description of an in-flight-execution (where change order or order cancellations are transmitted at the exact moment the order is filling on the exchange servers) is possible.
    Please see the help guide on the 'Risks of Electronic Trading with NinjaTrader' in the section 'In Flight Executions'.

    If NinjaTrader has not received a reply on an order, any further orders will be queued. If no information is received on an order, this will cause an error to appear in a popup in NinjaTrader.

    I'm not certain on the operations you are comparing, however, performing an if switch and doing a simple math operation are both likely to consume a single CPU cycle.
    I would recommend contacting a operating system engineer that would be able to further detail the exact amount of CPU caused by each operation type and variable byte size.
    Chelsea B.NinjaTrader Customer Service


      Thanks a lot Chelsea for your help

      Best regards


      Latest Posts


      Topics Statistics Last Post
      Started by AlessioCianini12, Today, 01:38 AM
      0 responses
      1 view
      Last Post AlessioCianini12  
      Started by nandhumca, Yesterday, 11:54 PM
      0 responses
      Last Post nandhumca  
      Started by nandhumca, Yesterday, 11:51 PM
      0 responses
      Last Post nandhumca  
      Started by ezrollin, Yesterday, 11:48 PM
      2 responses
      Last Post ezrollin  
      Started by jjanguda, Yesterday, 10:15 PM
      0 responses
      Last Post jjanguda