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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      156 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      90 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      140 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      130 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X