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 GwFutures1988, Today, 02:48 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by ScottWalsh, 04-16-2024, 04:29 PM
      6 responses
      32 views
      0 likes
      Last Post ScottWalsh  
      Started by frankthearm, Today, 09:08 AM
      10 responses
      36 views
      0 likes
      Last Post frankthearm  
      Started by mmenigma, Today, 02:22 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by NRITV, Today, 01:15 PM
      2 responses
      10 views
      0 likes
      Last Post NRITV
      by NRITV
       
      Working...
      X