Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    548 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    549 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X