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 DanielTynera, Today, 01:14 AM
    0 responses
    2 views
    0 likes
    Last Post DanielTynera  
    Started by yertle, 04-18-2024, 08:38 AM
    9 responses
    40 views
    0 likes
    Last Post yertle
    by yertle
     
    Started by techgetgame, Yesterday, 11:42 PM
    0 responses
    10 views
    0 likes
    Last Post techgetgame  
    Started by sephichapdson, Yesterday, 11:36 PM
    0 responses
    2 views
    0 likes
    Last Post sephichapdson  
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,615 views
    0 likes
    Last Post aligator  
    Working...
    X