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 DannyP96, 05-18-2026, 02:38 PM
    1 response
    27 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    117 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    69 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    226 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    418 views
    0 likes
    Last Post CaptainJack  
    Working...
    X