Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SendMail - Multiple Notifications

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

    SendMail - Multiple Notifications

    I get several email notifications of the same event as the market "breathes" back and forth. If Calculate.OnPriceChange or Calculate.OneachTick is set to true. Calculate.OnBarClose doesn't generate this problem.

    In my case, whenever my strategy enters long or short, SendMail is activated; but I may get 10 emails for the same thing. Since only 1 entry per direction is allowed, I don't get several entries though! But how do I stop this? I need to calculate on Price change rather than on bar close and I'd like to receive the notice only once for every unique event.

    Many thanks.

    #2
    Hello aaadetos,

    Thanks for your post.

    In your code section that sends the mail you can add the action to save the current bar number into an integer variable (for example called savedBar). As part of the condition to send the e-mail you check to see if the current bar is not the same as the saved bar.

    if (your conditions && CurrentBar != savedBar)
    {
    sendMail(...);
    savedBar = CurrentBar; // save current bar number
    }

    The example would limit e-mail to once per bar.

    Comment


      #3
      Thanks Paul,
      But what if the condition changes and say fired long initially, then fires short before the bar was finished (say a 30-minute bar), the email will not send for the new event. Is there a way to capture the change in event even within the current bar? so long as it is unique and different? This could potentially happen, since it calculates on price change.

      Thank you.

      Comment


        #4
        Hello aaadetos,

        Thanks for your reply.

        Basically, you have the idea now to use a bool to control the e-mail. You can certainly use the same code block where you place your orders to also set the bool so that if you are long and then go short that the bool will also switch and allow the e-mail to occur. So you can still have the bool reset by a new bar and reset by a change in order direction.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        79 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        45 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        29 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        32 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        64 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X