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

Easiest way to verify the content of an email sent automatically

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

    Easiest way to verify the content of an email sent automatically

    Hi,

    In my strategy, an email is automatically sent on the execution of any order.
    I build the content of the email as such :

    if(execution.Order.Name == "Profit target"){
    mail_content = "Profit target at : " + execution.Price + Environment.NewLine;
    }

    etc...

    It didn't require much testing. I just ran the strategy live in real time and checked the result.

    How could I build a mail that contains HTML tags and some styling and test the output easily? If it's impossible, I'll send the email from an external script.

    Thanks

    #2
    Hello Vincere,

    The most simple way to test this would be to use a indicator with a button. You can click the button to send a email to test whatever HTML code you supply.

    Some samples that come to mind are the user control collection sample, this is all the code needed for two buttons in an indicator: https://ninjatrader.com/support/help...ub=usercontrol

    There is also a full sample here with a button: https://ninjatrader.com/support/foru...bs?postcount=2

    You could modify these samples to include in the buttons event handler a Share to test the string you make.

    Alternatively a more basic way would be creating an indicator with a realtime check and bool to do something once:

    Code:
    private bool doOnce = false; 
    
    //OnBarUpdate: 
    
    if(State == State.Realtime && doOnce != true)
    {
        // send email
        doOnce = true;
    }

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by SnailHorn, Yesterday, 10:49 PM
    1 response
    10 views
    0 likes
    Last Post SnailHorn  
    Started by manueldecastro, Yesterday, 10:26 AM
    4 responses
    21 views
    0 likes
    Last Post manueldecastro  
    Started by TraderIqbal, 10-20-2023, 10:12 AM
    2 responses
    119 views
    0 likes
    Last Post Funnywo
    by Funnywo
     
    Started by Creamers, 04-27-2024, 05:32 AM
    12 responses
    72 views
    0 likes
    Last Post Creamers  
    Started by fredericlebre, Today, 01:19 AM
    0 responses
    10 views
    0 likes
    Last Post fredericlebre  
    Working...
    X