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

Open Orders

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

    Open Orders

    Hi

    How can I get all the non-filled orders (and their IOrder) which already exist on my account?

    Thanks

    #2
    Hello,

    Thank you for the question.

    For checking All non filled orders, there is not really a collection of these items. What you could do is to check in the OnOrderUpdate or OnExection for orders that come through with a status of not filled. This would provide the IOrder for that specific order.

    There is a simple example of this checking for filled orders which could be reversed to check for anything but filled orders located here: http://www.ninjatrader.com/support/h...ub=onExecution

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Is there a way to recognize orders and positions which were created outside of my strategy?

      Thanks

      Comment


        #4
        Hello kiss987,

        Thanks for your post.

        There is no supported method to accomplish this.

        Here is an unsupported method that you can use at your own risk:

        Code:
        foreach (Account acct in Cbi.Globals.Accounts)
        {
        if (acct.Positions != null)
        {
        PositionCollection positions = acct.Positions;
        foreach (Position pos in positions)
        {
        Print(pos.Account.Name + " " + pos.Instrument + " " + pos.MarketPosition + " " + pos.Quantity + " " + pos.AvgPrice);
        }
        }
        Also, this post may provide further info: http://ninjatrader.com/support/forum...ad.php?t=68029
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bmarovets, Today, 06:33 PM
        0 responses
        6 views
        0 likes
        Last Post bmarovets  
        Started by ETFVoyageur, Yesterday, 07:05 PM
        4 responses
        34 views
        0 likes
        Last Post ETFVoyageur  
        Started by JGriff5646, Yesterday, 10:02 PM
        2 responses
        22 views
        0 likes
        Last Post JGriff5646  
        Started by DawnTreader, Today, 05:58 PM
        0 responses
        5 views
        0 likes
        Last Post DawnTreader  
        Started by ntram, Today, 05:39 PM
        0 responses
        5 views
        0 likes
        Last Post ntram
        by ntram
         
        Working...
        X