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

[SubmitOrderUnmanaged] Strategy.Orders and Account.Orders don't show pending orders

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

    [SubmitOrderUnmanaged] Strategy.Orders and Account.Orders don't show pending orders

    Is this a known and desired behavior of NT?

    Strategy.Orders and Account.Orders don't show pending orders with SubmitOrderUnmanaged()

    REPRO: Create and submit an unmanaged order with SubmitOrderUnmanaged() - tested using Strategy Analyzer / backtest.

    NOTE: I get callbacks for OnOrderUpdate

    EXPECTED: Strategy.Orders and Account.Orders should include this pending order

    ACTUAL: both of these lists are empty

    NOTE#2: I was sure that I remember debugging into this list and seeing it populated at some point.

    ----
    Edit: more observations

    Strategy.Account.Positions is empty but Strategy.Positions is not, along with Strategy.PositionsAccount which is also as expected.
    Last edited by ntdev; 08-17-2021, 04:41 AM.

    #2
    Hello ntdev,

    The Strategy.Orders and strategy based Account property.Orders collections are not documented for strategy use so I couldn't say if that should or should not contain the orders in that state in this use case.

    In general working with the order collections or account when using a strategy is not the correct approach, you should be instead using the order events from OnOrderUpdate to track relevant orders through their states. You could also use the relevant strategy properties that you mentioned like Position etc. It sounds like you are seeing the correct OnOrderUpdate and other properties so it sounds like the script is working as expected.

    If you need to work directly with the account or its collections I would suggest looking into using an Indicator and avoiding strategies all together. An indicator using the addon framework could observe an account and its collections directly.

    Please let me know if I may be of further assistance.






    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesse. Yes, that's what I did -- I save the information myself during OnOrderUpdate and OnExecutionUpdate.

      It just seems that this "Orders" object should contain the orders or why have it if it does nothing and can't be used?

      But I understand now that it's undocumented -- thanks for clarifying that.

      Comment


        #4
        Hello ntdev,

        That collection likely has some internal use, strategies can be used in a variety of locations and the fact that its not documented likely leads to some internal use case which is not necessarily helpful for a realtime strategy.

        You should be able to use the approach in the following link to find an account (not using the strategies existing Account property) and from the found account you could access all of the accounts orders.


        The orders should exist there because that collection is intended to be accessed directly, generally from indicators/addons. Because a strategy has overrides which filter for its specific orders that would be the suggestion to use the overrides and track the strategies individual orders excluding the other account info.

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        11 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        10 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        12 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,982 views
        3 likes
        Last Post jhudas88  
        Started by rbeckmann05, Yesterday, 06:48 PM
        0 responses
        10 views
        0 likes
        Last Post rbeckmann05  
        Working...
        X