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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        163 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        82 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        125 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        206 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        185 views
        0 likes
        Last Post CarlTrading  
        Working...
        X