Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnOrderUpdate/OnExecution Email execution

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

    OnOrderUpdate/OnExecution Email execution

    I came across this script for email trade execution, referenced in this post on the forum.

    The suggestion in the post was that the method (pasted below) from the email execution script could be used for OnOrderUpdate "...but try OrderUpdateEventArgs instead"

    When I tried that I got a compile error "The type or namespace name 'OrderUpdateEventArgs' could not be found (are you missing a using directive or an assembly reference?)" Any ideas on how to make this work would be much appreciated.

    Code:
    private void OnExecution(object sender, ExecutionUpdateEventArgs e)
    {[INDENT]if (e.Execution.Order != null)[/INDENT][INDENT]{[/INDENT][INDENT=2]if (e.Execution.Order.OrderState == OrderState.Filled)
    {[/INDENT][INDENT=3]this.SendMail(fromEmailAddress, toEmailAddress, "NinjaTrader Trade Confirmation", "Trade filled for: " + e.Execution.ToString());
    
    return;[/INDENT][INDENT=2]}[/INDENT][INDENT] [/INDENT][INDENT=2]if (emailPartFilled && e.Execution.Order.OrderState == OrderState.PartFilled)
    {[/INDENT][INDENT=3]this.SendMail(fromEmailAddress, toEmailAddress, "NinjaTrader Trade Confirmation", "Trade filled for: " + e.Execution.ToString());[/INDENT][INDENT=2]}[/INDENT][INDENT]}[/INDENT]
     }

    #2
    Hello newuser,

    Thanks for your post.

    When looking at the EmailTrades script I see that the script uses private void OnExecution(object sender, ExecutionUpdateEventArgs e) like in the sample code you shared.

    I was able to import the indicator 'EmailTrades' mentioned in the User App Share page that you shared without any compile errors occurring.

    Are you able to import the EmailTrades indicator into NinjaTrader 7 without compile issues occurring?

    Importing a NinjaScript could be done by navigating to File > Utilities > Import NinjaScript.

    Are you creating your own script that is using this method? If so, I would suggest comparing your custom indicator's code to the code of the EmailTrades indicator to see what is different in the EmailTrades script vs your own indicator script.

    Note the following from the forum thread you shared: this is unsupported programming and we don't have any documentation on it.

    Let us know if 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
      I can import and load the EmailTrades indicator into NinjaTrader 7 just fine. What I'd like to be able to do is create a method that will identify any order (rather than any execution) that is placed on my account. I am aware the post said it is undocumented but it is clearly possible/doable somehow...I was hoping you could give me a pointer on how to clear the aforementioned hurdle so I can make this work.

      Comment


        #4
        Hello newuser,

        Thanks for your note.

        Unfortunately, we would not be able to provide assistance with unsupported code.

        In the forum thread that you linked in your initial post, NinjaTrader_CalH said "You can try using the same method that is used for the execution but try OrderUpdateEventArgs instead. Note that this is unsupported programming.". This means that you could attempt using the same method but with OrderUpdateEventArgs, however, since it is not supported it is not guaranteed to work.

        That said, you could see this reference sample which demonstrates using OnOrderUpdate in a custom NinjaScript: https://ninjatrader.com/support/help...and_onexec.htm

        Also, see this OnOrderUpdate help guide page: https://ninjatrader.com/support/help...rderupdate.htm

        This thread will be open for other community members to share their insight on using the unsupported code.

        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

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X