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 PaulMohn, Today, 05:00 AM
    0 responses
    5 views
    0 likes
    Last Post PaulMohn  
    Started by ZenCortexAuCost, Today, 04:24 AM
    0 responses
    5 views
    0 likes
    Last Post ZenCortexAuCost  
    Started by ZenCortexAuCost, Today, 04:22 AM
    0 responses
    2 views
    0 likes
    Last Post ZenCortexAuCost  
    Started by SantoshXX, Today, 03:09 AM
    0 responses
    16 views
    0 likes
    Last Post SantoshXX  
    Started by DanielTynera, Today, 01:14 AM
    0 responses
    3 views
    0 likes
    Last Post DanielTynera  
    Working...
    X