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 Mindset, 04-21-2026, 06:46 AM
                  0 responses
                  87 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by M4ndoo, 04-20-2026, 05:21 PM
                  0 responses
                  132 views
                  0 likes
                  Last Post M4ndoo
                  by M4ndoo
                   
                  Started by M4ndoo, 04-19-2026, 05:54 PM
                  0 responses
                  68 views
                  0 likes
                  Last Post M4ndoo
                  by M4ndoo
                   
                  Started by cmoran13, 04-16-2026, 01:02 PM
                  0 responses
                  118 views
                  0 likes
                  Last Post cmoran13  
                  Started by PaulMohn, 04-10-2026, 11:11 AM
                  0 responses
                  67 views
                  0 likes
                  Last Post PaulMohn  
                  Working...
                  X