Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Rearms of Email Alerts

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

    Rearms of Email Alerts

    Hi there.

    I'm wondering about the possibilities of rearming the sendemail() function. So right now we have the following as standard syntax:

    SendMail("[email protected]", "Trade Alert", "Buy ES");

    Unfortunately this provides few options. For example if the code is:

    If Close[0] > than say 1000

    else If Close [0]>2000

    SendEmail()

    the emails will be sent non stop once the Close[0] > 1000.

    Ideally this will only place a single time once Close[0] > 1000 then send another email once Close [0]>2000.

    I'm not seeing anything in the literature on this. I'm able to configure normal sound alerts with this code and was wondering if I could do something similar with the SendEmail() function:

    Alert(string id, Priority priority, string message, string soundLocation, int rearmSeconds, Brush backBrush, Brush foreColor)

    Thanks in advance
    DJ





    #2
    You likely will be best served by adding bool logic to control the irregularity of the occurrences,

    if (doit1000 && Close[0] > 1000)
    {
    doit1000 = false;
    SendEmail(...);
    }

    if (doit2000 && Close[0] > 2000)
    {
    doit2000 = false;
    SendMail(...);
    }

    doit1000 and doit2000 should be declared as private bool type and should be set to true.

    This will allow one and only one e-mail until you reset the bools back to true. You can reset the bools back to true with another set of conditions of your own or use something like:

    if (Bars.IsFirstBarOfSession)
    {
    doit1000 = true; // reset for new session
    doit2000 = true; // reset for new session
    }

    Comment


      #3
      Hi DJ, thanks for writing in.

      The SendEmail() method can be called as many times are you want in the script. The re-arm behavior is determined by your own C# code e.g. using boolean variables to control the flow of conditions. I liked an example for reference.

      Hi, To improve a strategy, I would like the condition to enter a trade to be triggered only after a second crossing happens. Meaning, for instance we have a sthocastics crossing, but the strategy would only trigger when a crossing between 2 emas happen. Would the looking back N bars work? Can it be done within the builder

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      627 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      359 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      562 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      567 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X