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

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.
    Brandon H.NinjaTrader Customer Service

    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.

        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,404 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        95 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
        159 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        8 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X