• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 saltminer, Today, 06:11 PM
      0 responses
      2 views
      0 likes
      Last Post saltminer  
      Started by epitoma, Today, 05:21 PM
      1 response
      15 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by BatBart, Today, 01:24 PM
      1 response
      22 views
      0 likes
      Last Post NinjaTrader_Melissa  
      Started by ezrakoper, Today, 03:05 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by asmmbillah, Today, 02:23 PM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X