• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get AccountOrders in backtesting

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

    Get AccountOrders in backtesting

    Hi,

    I developed a strategy on NT8 that uses AccountOrders to find out which orders are posted and then with this information, make a decision.
    In real time and in Playback the strategy works correctly.

    However, when performing backtesting, AccountOrders does not return orders to me and due to this I am not able to use StrategyAnalyzer.

    How can I get the list of orders that were sent by the strategy in backtesting ?


    Thanks.

    #2
    Hello brunoviveiros,

    I wanted to gather more details on what you are trying to do. What is the goal of using the account directly here? Are you intending to run multiple strategies or was that just one way to access order information that you located?

    If you are referencing an account directly that won't work for backtesting or historical trades, you have effectively created a realtime only strategy by referencing the account and its orders. Generally the approach in the following example would be used for tracking orders: https://ninjatrader.com/support/help...and_onexec.htm

    This would work in a backtest because the strategies order overrides are being used, the orders being seen in the backtest would not exist in the Account because they weren't actual orders in realtime.


    Please let me know if I may be of additional assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      What is the goal of using the account directly here?
      - For example, i want to know if my pending order (working) has been filled or not.

      Are you intending to run multiple strategies or was that just one way to access order information that you located?
      - At first it would be just one strategy being executed on my account, but in the future I may have several.


      Can I get a list of the orders that were sent by the strategy or the only way would be to track this information locally?
      Tks for your support.

      Comment


        #4
        Hello brunoviveiros,

        Thank you for the additional details.

        Based on this information It seems you are likely using the incorrect approach for what you are wanting to do. Strategies by nature have overrides which provide their order information as they work forward in time so you would track this locally instead of accessing a list of orders.

        The sample I provided would be where I would suggest starting, https://ninjatrader.com/support/help...and_onexec.htm

        That demonstrates monitoring orders and keeping them as objects in your script for later use. That would be how you check if a order is working or filled and that is actually showed in that sample:

        Code:
         else if (execution.Order.OrderState == OrderState.Filled && sumFilled == execution.Order.Filled)
        If you wanted to get a list of open orders that would entail that you would have a few order object variables, your script would track the orders as they progress and keep them as variables for use.


        I look forward to being of further assistance.






        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by olivares_alfre, Yesterday, 02:19 PM
        2 responses
        13 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by hiikila, Today, 02:40 AM
        0 responses
        2 views
        0 likes
        Last Post hiikila
        by hiikila
         
        Started by Beauregard, Yesterday, 11:50 PM
        0 responses
        15 views
        0 likes
        Last Post Beauregard  
        Started by renkodan, Yesterday, 11:56 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by J_o_s, 04-04-2020, 11:17 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X