Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Modifying PriceAlert Indicator

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

    Modifying PriceAlert Indicator

    I have already modified the PriceAlert Indicator as shown below. This added the SendMail feature to it, which forwards to my phone as an alert. I also want the alert to cancel after the first occurrence so I don't continue getting messages after it triggers. I believe I would use ResetAlert but I haven't gotten the script right. Can someone supply me with the line that I would add below to cancel the alert after it triggers? Thanks


    if ((triggerOnGreaterThan && Input[0] >= price - (TickSize * 0.5)) || (!triggerOnGreaterThan && Input[0] <= price + (TickSize * 0.5)))
    {
    triggered = true;
    Alert(DateTime.Now.Millisecond.ToString(), Cbi.Priority.Medium, "Price level '" + price + "' hit!", Cbi.Core.InstallDir + @"\sounds\Alert4.wav", 0, Color.Yellow, Color.Black);
    SendMail ("[email protected]", "[email protected]", "KOS Buy Alert", "Set Buy Order");
    }

    #2
    Hi stressless,

    ResetAlert() will make the alert active again. Using a value of 0 for Re-Arm after seconds means that it will only trigger once.

    It sounds like you need control mainly on the SendMail() command instead. You can add your own bool variable to this. Best may be a bool input so you could control send mail commands through the indicator properties.

    Declare in variables region:
    private bool doOnce;

    Add as a condition to your SendMail:
    Code:
    if ((triggerOnGreaterThan && Input[0] >= price - (TickSize * 0.5)) || (!triggerOnGreaterThan && Input[0] <= price + (TickSize * 0.5)))
    {
    triggered = true;
    Alert(DateTime.Now.Millisecond.ToString(), Cbi.Priority.Medium, "Price level '" + price + "' hit!", Cbi.Core.InstallDir + @"\sounds\Alert4.wav", 0, Color.Yellow, Color.Black);
    
    [COLOR="Blue"]     if(doOnce)[/COLOR]
         {
              SendMail ("[email protected]", "[email protected]", "KOS Buy Alert", "Set Buy Order");
    [COLOR="blue"]          doOnce = false;[/COLOR]
         }
    }
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      sendmail with price alert

      Hi..

      is it possible for someone to modify the price alert indy to include sendmail function?


      **how would you code smtpServer info in with the sendmail command? to send email with alert? ...(i do not want the system (MISC/OPTIONS.etc..) to send)

      smtp.XXX.com
      port587
      no ssl
      acct username: xyz
      acct pw: ~~~
      Last edited by mystiq; 07-29-2012, 01:58 PM. Reason: add info

      Comment


        #4
        can you post that modified price alert to the forum with the sendmail command?

        Comment


          #5
          Originally posted by NinjaTrader_RyanM View Post
          Hi stressless,

          ResetAlert() will make the alert active again. Using a value of 0 for Re-Arm after seconds means that it will only trigger once.

          It sounds like you need control mainly on the SendMail() command instead. You can add your own bool variable to this. Best may be a bool input so you could control send mail commands through the indicator properties.

          Declare in variables region:
          private bool doOnce;

          Add as a condition to your SendMail:
          Code:
          if ((triggerOnGreaterThan && Input[0] >= price - (TickSize * 0.5)) || (!triggerOnGreaterThan && Input[0] <= price + (TickSize * 0.5)))
          {
          triggered = true;
          Alert(DateTime.Now.Millisecond.ToString(), Cbi.Priority.Medium, "Price level '" + price + "' hit!", Cbi.Core.InstallDir + @"\sounds\Alert4.wav", 0, Color.Yellow, Color.Black);
          
          [COLOR="Blue"]     if(doOnce)[/COLOR]
               {
                    SendMail ("[email protected]", "[email protected]", "KOS Buy Alert", "Set Buy Order");
          [COLOR="blue"]          doOnce = false;[/COLOR]
               }
          }
          is this the only code needed to rcv emails? using sendmail() with priceAlert?

          what if your email settings are at DEFAULT?

          Comment


            #6
            Hello,

            Yes SendMail() is all you need to send emails from the code when a condition is true.

            However the email settings it is using would need to be what is set from Tools--> Misc
            MatthewNinjaTrader Product Management

            Comment


              #7
              thanks but...u miss understand..i am using the default settings...so...is there any extra code needed to show smtpserver;port;acctinfo...etc..?
              Last edited by mystiq; 07-29-2012, 05:52 PM. Reason: add info

              Comment


                #8
                is ninjatrader_ryan around?

                Comment


                  #9
                  Originally posted by mystiq View Post
                  is ninjatrader_ryan around?

                  did you set up tools->options ->misc?

                  Comment


                    #10
                    Hello,

                    question please: it seems that the pricealert indicator plots only with COBC=false. Right? But isn´t this CPU intensive (especially when having this on 12 charts?)

                    Thank you.
                    Tony

                    Originally posted by NinjaTrader_RyanM View Post
                    Hi stressless,

                    ResetAlert() will make the alert active again. Using a value of 0 for Re-Arm after seconds means that it will only trigger once.

                    It sounds like you need control mainly on the SendMail() command instead. You can add your own bool variable to this. Best may be a bool input so you could control send mail commands through the indicator properties.

                    Declare in variables region:
                    private bool doOnce;

                    Add as a condition to your SendMail:
                    Code:
                    if ((triggerOnGreaterThan && Input[0] >= price - (TickSize * 0.5)) || (!triggerOnGreaterThan && Input[0] <= price + (TickSize * 0.5)))
                    {
                    triggered = true;
                    Alert(DateTime.Now.Millisecond.ToString(), Cbi.Priority.Medium, "Price level '" + price + "' hit!", Cbi.Core.InstallDir + @"\sounds\Alert4.wav", 0, Color.Yellow, Color.Black);
                    
                    [COLOR=Blue]     if(doOnce)[/COLOR]
                         {
                              SendMail ("[email protected]", "[email protected]", "KOS Buy Alert", "Set Buy Order");
                    [COLOR=blue]          doOnce = false;[/COLOR]
                         }
                    }

                    Comment


                      #11
                      Hi tonynt,

                      The PriceAlert indicator does require COBC false.

                      This will be more CPU intensive than COBC true, however, this script does not have a lot of code and does not require much resources.

                      I wouldn't expect this indicator to cause heavy CPU usage.
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by kujista, Today, 05:44 AM
                      0 responses
                      6 views
                      0 likes
                      Last Post kujista
                      by kujista
                       
                      Started by ZenCortexCLICK, Today, 04:58 AM
                      0 responses
                      8 views
                      0 likes
                      Last Post ZenCortexCLICK  
                      Started by sidlercom80, 10-28-2023, 08:49 AM
                      172 responses
                      2,281 views
                      0 likes
                      Last Post sidlercom80  
                      Started by Irukandji, Yesterday, 02:53 AM
                      2 responses
                      18 views
                      0 likes
                      Last Post Irukandji  
                      Started by adeelshahzad, Today, 03:54 AM
                      0 responses
                      10 views
                      0 likes
                      Last Post adeelshahzad  
                      Working...
                      X