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 warreng86, 11-10-2020, 02:04 PM
      7 responses
      1,360 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Perr0Grande, Today, 08:16 PM
      0 responses
      5 views
      0 likes
      Last Post Perr0Grande  
      Started by elderan, Today, 08:03 PM
      0 responses
      9 views
      0 likes
      Last Post elderan
      by elderan
       
      Started by algospoke, Today, 06:40 PM
      0 responses
      10 views
      0 likes
      Last Post algospoke  
      Started by maybeimnotrader, Today, 05:46 PM
      0 responses
      14 views
      0 likes
      Last Post maybeimnotrader  
      Working...
      X