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 judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      36 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      7 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      21 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      10 views
      0 likes
      Last Post cre8able  
      Working...
      X