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

OnExecutionUpdate method is not called for all the order execution updates

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

    OnExecutionUpdate method is not called for all the order execution updates

    Hi, My strategy placed an order with 2 contract. One contract is filled first (PartFilled) and another contract is filled later. The OnOrderUpdate is called for both PartFilled and Filled status change. But the OnExecutionUpdate is called only for PartFilled and not called when the order Filled fully. OnExecutionUpdate will not be called on Filled status change ?

    Log :

    OnOrderUpdate called for PartFilled:


    2024-02-29 11:15:36:378|2|16|ID1 : 2/29/2024 11:30:00 AM | OOU | order | 2/29/2024 11:15:36 AM | orderId='1095676484' account='XXXXXX' name='ID1$Long' orderState=PartFilled instrument='NQ 03-24' orderAction=Buy orderType='Stop Limit' limitPrice=18012.5 stopPrice=18012.5 quantity=2 tif=Gtc oco='' filled=1 averageFillPrice=18012.5 onBehalfOf='' id=11144 time='2024-02-29 11:15:36' gtd='2099-12-01' statementDate='2024-02-29'

    OnExecutionUpdate called for PartFilled:

    2024-02-29 11:15:36:379|2|16|ID1 : 2/29/2024 11:30:00 AM | OEU | execution update | 2/29/2024 11:15:36 AM | orderId='1095676484' account='XXXXXX' name='ID1$Long' orderState=PartFilled instrument='NQ 03-24' orderAction=Buy orderType='Stop Limit' limitPrice=18012.5 stopPrice=18012.5 quantity=2 tif=Gtc oco='' filled=1 averageFillPrice=18012.5 onBehalfOf='' id=11144 time='2024-02-29 11:15:36' gtd='2099-12-01' statementDate='2024-02-29'

    OnOrderUpdate called for Filled:

    2024-02-29 11:15:36:652|2|16|ID1 : 2/29/2024 11:30:00 AM | OOU | order | 2/29/2024 11:15:36 AM | orderId='1095676484' account='XXXXXX' name='ID1$Long' orderState=Filled instrument='NQ 03-24' orderAction=Buy orderType='Stop Limit' limitPrice=18012.5 stopPrice=18012.5 quantity=2 tif=Gtc oco='' filled=2 averageFillPrice=18012.5 onBehalfOf='' id=11144 time='2024-02-29 11:15:36' gtd='2099-12-01' statementDate='2024-02-29'

    No OnExecutionUpdate ​ is called when the order is Filled.

    #2
    Hello nandhumca,

    Do you have your print inside any conditions or just at the top of each override? If you have the print inside conditions try placing the print as the first line of each override instead. If you are already doing that what broker or connection/account is being used during this test?

    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi, there is no condition. Log statement is the first line of the method in both methods.

      Comment


        #4
        Hello nandhumca,

        What broker or connection/account is being used during this test?
        JesseNinjaTrader Customer Service

        Comment


          #5
          APEX / Rithmic

          Comment


            #6
            Hello nandhumca,

            Rithmic does not produce events in a specific order like other brokers, to use the order events for processing you would need to form your logic like the sample in the following page:

            Hello, I see in the documentation you have fixed: 15048 Added Adapter, Rithmic Updated Rithmic API to version 11.3.0.0 Can you elaborate on that please? Will OnOrderUpdate() OnExecutionUpdate() and OnPositionUpdate() be called in the expected order?
            JesseNinjaTrader Customer Service

            Comment


              #7
              thanks. can we rely on OnOrderUpdate​ event to place / manage the SL/PT order ?

              with rithmic, order is not my concern. I haven't got any event for the order filled is my problem.

              Comment


                #8
                Hello nandhumca,

                Yes in that case you are seeing the filled from OnOrderUpdate so you could adjust the logic to use that event to submit targets.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  NinjaTrader_Jesse Regardless of broker/connection, and ignoring the sequence in which it happens, shouldn't OnOrderUpdate (for all Orders) and OnExecutionUpdate (for all Executions) always be called?

                  Thanks.​
                  Last edited by jeronymite; 03-04-2024, 01:32 AM. Reason: Minor rewording for clarity. (Changed "order" to "sequence".)
                  Multi-Dimensional Managed Trading
                  jeronymite
                  NinjaTrader Ecosystem Vendor - Mizpah Software

                  Comment


                    #10
                    Hi NinjaTrader_Jesse the question jeronymite is valid right ? OnOrderUpdate (for all Orders) and OnExecutionUpdate (for all Executions)​ should be called always irrespective of broker right ?

                    Comment


                      #11
                      When I tried to place PT/SL order from OnOrderUpdate method, order is rejected with message "This was an exit order but no position exists to exit " . I have tested this on playback .

                      2024-03-03 22:27:30.155 ID1 : 2024-03-03 22:27:30.155 Strategy '/293570599': Entered internal SubmitOrderManaged() method at 3/13/2023 6:26:25 AM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=12034.25 StopPrice=0 SignalName='ID1ltarget' FromEntrySignal='ID1$Long'
                      2024-03-03 22:27:30.155 ID1 : 2024-03-03 22:27:30.155 Strategy '/293570599': Ignored SubmitOrderManaged() method at 3/13/2023 6:26:25 AM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=12034.25 StopPrice=0 SignalName='ID1ltarget' FromEntrySignal='ID1$Long' Reason='This was an exit order but no position exists to exit'
                      2024-03-03 22:27:30.155 ID1 : 2024-03-03 22:27:30.155 Strategy '/293570599': Entered internal SubmitOrderManaged() method at 3/13/2023 6:26:25 AM: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=11989.75 SignalName='ID1lstop' FromEntrySignal='ID1$Long'
                      2024-03-03 22:27:30.155 ID1 : 2024-03-03 22:27:30.155 Strategy '/293570599': Ignored SubmitOrderManaged() method at 3/13/2023 6:26:25 AM: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=1 LimitPrice=0 StopPrice=11989.75 SignalName='ID1lstop' FromEntrySignal='ID1$Long' Reason='This was an exit order but no position exists to exit'​

                      Comment


                        #12
                        Hello nandhumca,

                        In playback data the event operations would happen similar to other brokers because a simulation account is being used. You would need to use OnExecutionUpdate for that use case if you are using managed approach orders with signal names. In realtime rithmic will not have the same order of events, the sequence of events are not guaranteed due to provider API design. You would need to test in realtime on the rithmic connection to ensure the logic works per your strategies design when using rithmic.
                        JesseNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by fx.practic, 10-15-2013, 12:53 AM
                        5 responses
                        5,406 views
                        0 likes
                        Last Post Bidder
                        by Bidder
                         
                        Started by Shai Samuel, 07-02-2022, 02:46 PM
                        4 responses
                        98 views
                        0 likes
                        Last Post Bidder
                        by Bidder
                         
                        Started by DJ888, Yesterday, 10:57 PM
                        0 responses
                        8 views
                        0 likes
                        Last Post DJ888
                        by DJ888
                         
                        Started by MacDad, 02-25-2024, 11:48 PM
                        7 responses
                        160 views
                        0 likes
                        Last Post loganjarosz123  
                        Started by Belfortbucks, Yesterday, 09:29 PM
                        0 responses
                        9 views
                        0 likes
                        Last Post Belfortbucks  
                        Working...
                        X