Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    31 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    64 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X