Announcement

Collapse
No announcement yet.

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.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    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 NullPointStrategies, Today, 05:17 AM
            0 responses
            52 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            70 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            43 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            47 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X