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 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. ​
    Gaby V.NinjaTrader Customer Service

    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
        Gaby V.NinjaTrader Customer Service

        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 futtrader, 04-21-2024, 01:50 AM
                  4 responses
                  41 views
                  0 likes
                  Last Post futtrader  
                  Started by Option Whisperer, Today, 09:55 AM
                  1 response
                  11 views
                  0 likes
                  Last Post bltdavid  
                  Started by port119, Today, 02:43 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post port119
                  by port119
                   
                  Started by Philippe56140, Today, 02:35 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post Philippe56140  
                  Started by 00nevest, Today, 02:27 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post 00nevest  
                  Working...
                  X