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

About this event: Event handler<OrderEventArgs> Account.OrderUpdate

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

    About this event: Event handler<OrderEventArgs> Account.OrderUpdate

    I have a question about this event:
    Event handler<OrderEventArgs> Account.OrderUpdate

    What about when we associate a method to this event handler to capture all order updates within a strategy running on two charts with the same instrument?

    Say i have this method defined in a strategy:

    private void OnOrderUpdate(object sender, OrderEventArgs e)
    {
    NinjaTrader.Code.Output.Process(string.Format("Ord er.Name: {0} OrderId: {1} OrderState: {2}",
    e.Order.Name, e.OrderId, e.OrderState), PrintTo.OutputTab1);
    }


    Is it possible to determine to which instance of the strategy running on both charts a specific order belongs?

    Both instances will receive the same event or message without any possibility to know which chart submitted an order.

    In this example, the chart to the left submitted an order but both instances of the strategy reported it in their own OnOrderUpdate event handler.

    Click image for larger version  Name:	OrderUpdateEvent.jpg Views:	0 Size:	313.4 KB ID:	1195286
    Last edited by trendisyourfriend; 03-25-2022, 04:22 PM.

    #2
    Hello trendisyourfriend,

    Thanks for your post.

    Unfortunately, there are no documented or supported methods available to determine which instance of the strategy placed the order or which chart specific orders are on.

    When working with the account events you are only going to get the execution or order event, not attached to a specific strategy.

    Account.OrderUpdate: https://ninjatrader.com/support/help...rderupdate.htm

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      You could name your Orders with a Strategy-specific name format, then filter on that in OnOrderUpdate.
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      Comment


        #4
        Originally posted by jeronymite View Post
        You could name your Orders with a Strategy-specific name format, then filter on that in OnOrderUpdate.
        Not sure how i could do this. The name is already set in stone such as "Entry", "Stop1", "Stop2", "Target1", "Target2" etc. I can't see how i could change this.

        Comment


          #5
          I presume you are using the Managed approach. If so, all the Enter... methods have an optional signalName parameter that is a settable string.

          For example, EnterLong(int quantity, string signalName). You could give each of your your strategies a unique identifiable string name and add a unique suffix for each order to generate uniquely identifiable orders within uniquely identifiable strategies. In OnOrderUpdate, filter on the signalName.

          However, if you submit directly from the chart or ChartTrader, this is not useful; but you seem to be submitting from your Strategy.

          Does that help?

          Thanks.
          Multi-Dimensional Managed Trading
          jeronymite
          NinjaTrader Ecosystem Vendor - Mizpah Software

          Comment


            #6
            Thank you for your reply. As i am using the AtmStrategyCreate() method to submit an order then i can't proceed as you describe. Unlike NinjaScript Strategy orders (both managed and unmanaged), ATM strategies generated by the AtmStrategyCreate() method can then be managed manually by any order entry window such as the SuperDOM or within your NinjaScript strategy.

            Originally posted by jeronymite View Post
            I presume you are using the Managed approach. If so, all the Enter... methods have an optional signalName parameter that is a settable string.

            For example, EnterLong(int quantity, string signalName). You could give each of your your strategies a unique identifiable string name and add a unique suffix for each order to generate uniquely identifiable orders within uniquely identifiable strategies. In OnOrderUpdate, filter on the signalName.

            However, if you submit directly from the chart or ChartTrader, this is not useful; but you seem to be submitting from your Strategy.

            Does that help?

            Thanks.
            Last edited by trendisyourfriend; 03-27-2022, 04:55 PM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Segwin, 05-07-2018, 02:15 PM
            14 responses
            1,788 views
            0 likes
            Last Post aligator  
            Started by Jimmyk, 01-26-2018, 05:19 AM
            6 responses
            837 views
            0 likes
            Last Post emuns
            by emuns
             
            Started by jxs_xrj, 01-12-2020, 09:49 AM
            6 responses
            3,293 views
            1 like
            Last Post jgualdronc  
            Started by Touch-Ups, Today, 10:36 AM
            0 responses
            12 views
            0 likes
            Last Post Touch-Ups  
            Started by geddyisodin, 04-25-2024, 05:20 AM
            11 responses
            62 views
            0 likes
            Last Post halgo_boulder  
            Working...
            X