Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter Orders not from OnBarUpdate()

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

    Enter Orders not from OnBarUpdate()

    If I don't want to enter a trade order EnterLong() in OnBarUpdate(), can I enter the EnterLong() in other places, such as MyCustomeHandler() which is checked every 1 second?

    #2
    Hello appleseed,

    Yes, you can place orders other than OnBarUpdate() but not necessarily every place in your script. You need to check that the order methods are available within the scope you're trying to place them. You can see the following sample for help placing orders outside OnBarUpdate()

    The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan,

      Here you provided another good example of event driven method, or OnExecution(). So I assume other similar places such as OnMarketDepth() should be fine too?

      Also when you said "to check that the order methods are available within the scope", how do I make sure this is indeed in the scope?

      Thanks.

      Comment


        #4
        You only need to check that EnterLong(); and other order methods compiles successfully within your custom event.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        672 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        379 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        577 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        582 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X