• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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);
    
         if(doOnce)
         {
              SendMail ("[email protected]", "[email protected]", "KOS Buy Alert", "Set Buy Order");
              doOnce = false;
         }
    }
    Ryan MNinjaTrader 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);
          
               if(doOnce)
               {
                    SendMail ("[email protected]", "[email protected]", "KOS Buy Alert", "Set Buy Order");
                    doOnce = false;
               }
          }
          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);
                    
                         if(doOnce)
                         {
                              SendMail ("[email protected]", "[email protected]", "KOS Buy Alert", "Set Buy Order");
                              doOnce = false;
                         }
                    }

                    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 wolfcuring, Today, 04:08 AM
                      0 responses
                      4 views
                      0 likes
                      Last Post wolfcuring  
                      Started by cirzonorkecv, Yesterday, 11:52 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post cirzonorkecv  
                      Started by rickyblah12, Yesterday, 01:01 PM
                      1 response
                      14 views
                      0 likes
                      Last Post Erwin Beckers  
                      Started by dadarara, Yesterday, 12:18 PM
                      0 responses
                      8 views
                      0 likes
                      Last Post dadarara  
                      Started by joemiller, Yesterday, 07:33 AM
                      2 responses
                      13 views
                      0 likes
                      Last Post joemiller  
                      Working...
                      X