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 DavidHP, Today, 07:56 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by kujista, Today, 06:23 AM
    3 responses
    6 views
    0 likes
    Last Post kujista
    by kujista
     
    Started by Mindset, Yesterday, 02:04 AM
    2 responses
    17 views
    0 likes
    Last Post NinjaTrader_RyanS  
    Started by f.saeidi, Today, 08:03 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by samish18, 04-17-2024, 08:57 AM
    15 responses
    52 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Working...
    X