Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Check for open / unfilled orders

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

    Check for open / unfilled orders

    I am trying to program entry on a pull back after entry logic as been triggered.

    fast moving average crosses above slow moving average... that would be a trigger

    Then place a limit order at that trigger price minus X amount of ticks.

    Once this limit order is out there I need to check to see if there is already another order pending.

    Basically if one order has triggered but never filled and the same trigger happens again I do not want to place a second order.

    I guess another possibility would be to set a Boolean to true when the order is entered and check that on each trigger event.

    #2
    Hello sdauteuil,

    You can assign an order object from OnOrderUpdate() to a variable and then check to see if that variable is not null, and if the order.OrderState is OrderState.Working.

    Below are links to the help guide.
    https://ninjatrader.com/support/help...rderupdate.htm
    https://ninjatrader.com/support/help.../nt8/order.htm
    Last edited by NinjaTrader_ChelseaB; 11-02-2020, 10:41 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Just to make sure I have flow correct

      set variable
      private Order entryOrder = null;

      OnBarUpdate
      {
      Entry Logic == True
      entryOrder == null
      Place order

      My custom trailing stops
      }

      // end of OnBarUpdate - begin OnOrderUpate

      OnOrderUpdate
      {
      // set entry order to != null if there is a working order

      if (order.OrderState == OrderState.Working)
      entryOrder != null;
      }
      // end of OnOrderUpdate


      Newbie programmer question...
      Are OnBarUpdate and OnOrderUpdate Methods?

      Comment


        #4
        Hello sdauteuil,

        Yes, OnBarUpdate() and OnOrderUpdate() are methods.

        The order object will be supplied as a property from OnOrderUpdate(), this can be assigned to a variable for later reference.
        Please see the code example in the help guide page for OnOrderUpdate() linked in post #2.

        I am including a link to a forum post with helpful information about getting started with NinjaScript.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        44 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        65 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X