Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sleep (or wait) timer

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

    Sleep (or wait) timer

    I have a Ninja Automated trading script running in realtime (CalculateOnBarClose=false) and I sometimes face the issue of having my orders executed twice. (It seems the internal program loop goes faster than IB order execution).

    Can I either :

    1) put a timer in the program after my order instructions. If so what is the instruction to use?

    (I've tried the instruction Sleep(5000), which is a C# instruction, but Ninja compiler does not recognize it. I haven't found any instruction like wait(), pause() or sleep() in NinjaTrader documentation)



    2) or wait until the instruction (for example enterlong()) is executed before going further. If so how sould I proceed?



    Thank you in advance.

    #2
    We do not suggest manipulating threads. Alternatively, you can take a look at 6.5 event driven methods such as OnOrderUpdate(), this will allow you to monitor changes in order states and use this to better control program flow.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thank you Ray

      I'll try to use the recommended method.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      144 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      71 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      125 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      79 views
      0 likes
      Last Post PaulMohn  
      Working...
      X