Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnExecutionUpdate event is NOT firing...

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

    OnExecutionUpdate event is NOT firing...

    I coded my strat overriding the "OnExecutionUpdate" event:

    protected override void OnExecutionUpdate(...
    But the "OnExecutionUpdate"
    event never fires when backtesting...

    Note: I do have
    IsUnmanaged = true;
    in the "State.SetDefaults" and am using "SubmitOrderUnmanaged" to submit the order.

    Is there some other setting somewhere to get this event working?

    #2
    Hello waltFX,

    Thank you for your post.

    Please try testing by placing a print for the execution in OnExecutionUpdate() to troubleshoot? For example:

    Print("Execution: " + execution.ToString());

    Prints will show up in the NinjaScript Output window. This forum post goes over using prints to debug:



    I look forward to being of further assistance. ​

    Comment


      #3
      I am using VS in the debug mode and see other events triggering with no issue...

      Comment


        #4
        Hello waltFX,

        Can you please clarify, did you debug the print using prints? Did the execution not print out when you backtested the script?

        I tested using the attached script on my end. I am able to see OnExecutionUpdate() firing in backtest by printing out the execution.
        Attached Files

        Comment


          #5
          yes, I saw using print.... so I'm guessing it does not work with the VS debugger?
          If that's the answer, then it looks like I'll be using "print"... (not my first choice)
          Thanks!

          Comment


            #6
            Actually, I just checked and it does NOT fire; I had a print in the "onbarUpdate" and that was where I saw it based on the order created by the submit...
            So, NO, OnExecutionUpdate() is not being fired...
            I will review the code you sent to see if I can find what is different.

            Comment


              #7
              After reviewing your example and much head scratching, I now have it working.

              Thank You!

              Comment


                #8
                waltFX Very pleased to hear you now have it working. Well done.

                For all the curious Forum readers and programmers, if you have found a solution to something, it's always good practice to post the actual solution, as well as "Yehaaaa, it works!". Something to consider.

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

                Comment


                  #9
                  a LOT of mucking around but a few things stand out:

                  add the code "IsUnmanaged = true here;"
                  protected override void OnStateChange()
                  {
                  if (State == State.SetDefaults)
                  {
                  IsUnmanaged = true;

                  And, the VS debug may not always stop where the stops are marked so use "print"...

                  Also, to tell the truth, I am still fighting to get consistent order event flows... I can't say definitely but seems the events are not in the expected sequence.

                  still fighting...

                  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
                  44 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  49 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X