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

Market Analyzer Email Alerts

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

    Market Analyzer Email Alerts

    Good morning.
    So I have an alert to send emails when something happens with indicators. Unfortunately, I keep getting a Mail Queue error, which I think is a function of there being no data present.
    I thought I could fix it by checking Connection Status, but I may be missing something or doing things wrong.

    Code:
    private ConnectionStatus dataFeed = ConnectionStatus.Connected;
    protected override void OnBarUpdate()
    {
    
    if (dataFeed == ConnectionStatus.Connected)
    {
    // Conditions to be run and email to be sent when data is present....
    }
    Attached is the error.
    Please advise. Thanks!
    Attached Files

    #2
    Hello aaadetos,

    Thanks for your post.

    We first recommend testing the EMail service outside of NinjaScript to confirm you are able to send emails from the platform. (Control Center > Tools > Options > Misc)

    Getting to the error message, it sounds like many email messages are being sent in too rapid of succession where the messages get dropped. If you add a print next to your SendMail line of code, you can view the Output window to see how often these email messages are being sent.

    You can then take actions to limit how often SendMail is called by modifying the logic of your NinjaScript. For example, you can save Time[0] to a private variable and then only allow new emails if your variable is greater than Time[0] from a certain number of seconds.

    I.E.

    Code:
    if (Time[0] > YourSavedTime.AddSeconds(5))
    {
        YourSavedTime = Time[0];
        SendMail(...);
    }

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by KennyK, 05-29-2017, 02:02 AM
    2 responses
    1,278 views
    0 likes
    Last Post marcus2300  
    Started by fernandobr, Today, 09:11 AM
    0 responses
    0 views
    0 likes
    Last Post fernandobr  
    Started by itrader46, Today, 09:04 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by timmbbo, Today, 08:59 AM
    0 responses
    2 views
    0 likes
    Last Post timmbbo
    by timmbbo
     
    Started by bmartz, 03-12-2024, 06:12 AM
    5 responses
    33 views
    0 likes
    Last Post NinjaTrader_Zachary  
    Working...
    X