Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 George21, Today, 10:07 AM
        0 responses
        5 views
        0 likes
        Last Post George21  
        Started by Stanfillirenfro, Today, 07:23 AM
        9 responses
        23 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by DayTradingDEMON, Today, 09:28 AM
        2 responses
        16 views
        0 likes
        Last Post DayTradingDEMON  
        Started by navyguy06, Today, 09:28 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        8 responses
        32 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X