Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Simple Indicator that alerts with every new bar

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

    #31
    Just so I understand how the output window works ...

    With the Print() commands in my current code, I should get two outputs every new bar right? (One for entering the onbarupdate() and the other upon entering the if () statement) Making sure I understand how the "calculateonbarclose = true" works.

    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    Overlay = false;
    PriceTypeSupported = false;
    }

    protected override void OnBarUpdate()
    {
    Print("Code has entered onbarupdate procedure");
    if (FirstTickOfBar)
    {
    Print("Code has entered if statement");
    SendMail("[email protected]", "[email protected]", "EURUSD - New Bar Alert", "New bar just opened");
    }
    }
    Last edited by Aithin; 02-08-2011, 10:19 AM.

    Comment


      #32
      You may have found part of the issue.

      If you run code with COBC=true this is does not have if (FirstTickOfBar) since there is no realtime tick processing. It only calculates on the bar close.

      Therefor with this indicator.

      Please take out if (firsttickofbar) check and then you should be good to go an indicator running with COBC=True is the same functionality.

      Let me know if I can be of further assistance.

      Comment


        #33
        I changed it to calculate on bar close = false. Kept the Print() command in the indicator and opened up the output window.

        I get the Print that it entered the IF statement, but no email. Do I have something wrong with the sendemail syntax?

        CODE COPY/PASTE**
        if (FirstTickOfBar)
        {
        Print("Code has entered if statement of EURUSD");
        SendMail("[email protected]", "[email protected]", "EURUSD - New Bar Alert", "New bar just opened");
        }

        ****I changed out my email address ... I have confirmed that it is accurate. I also checked my spam folder to make sure the messages are hiding in there , and they are not. I have no emails at all currently.

        Everything seems to be working except the email.

        Comment


          #34
          Hello,

          Can you please goto Control Center->Tools->Options->Misc tab and send a test email to yourself.

          Does this work?

          I look forward to assisting you further.

          Comment


            #35
            When I tried to send the mail I get an error ...

            Failed to Send Mail: error connecting to server. www.ninjatrader-support2.com

            Comment


              #36
              Hello,

              What anti virus or firewall software are you running on the PC?

              Do you have another PC to test from as your currently not able to send outbound emails on this PC from NinjaTrader as its eing blocked.

              I look forward to assisting you further.

              Comment


                #37
                I am using Ad Aware antivirus, with no firewall.

                I tried on another PC, and it still doesnt work. I also disabled the antivirus, with the same result.

                I am leaving the SMTP settings blank (default) should I be inputting something here?

                Also, I am using ninjatrader 6.5 (not sure if this makes any difference)

                Thanks

                Comment


                  #38
                  Hello,

                  Looks like you have something on your network then if it occurs on both PC's thats blocking the email from sending. In this case you will need to use your own mail server to send out the mail instead of the default one inside of Ninja.

                  You will need to yahoo or gmail account do you have one or can you create one?

                  I look forward to assisting you further.

                  Comment


                    #39
                    I'm currently sending the alerts to a gmail account. Can I use that one? or does it have to be different from the address that the alerts are sent?

                    Thank you very much for all your help so far ... I think we're getting closer

                    Comment


                      #40
                      Hello,

                      That is fine.

                      What you need to do is the following.

                      Goto Control Center->Tools->Options->Misc tab.

                      Then for the server: use smtp.google.com

                      then for username and password put in your email name not with @gmail.com on it

                      and yor email password. Then try to test send a message youyour gmail account it should now work.

                      User; username

                      password: gmailpassword

                      Let me know if I can be of further assistance.

                      Comment


                        #41
                        Now I get the error:
                        Failed to connect to smtp.gmail.com

                        Do I leave the support email as [email protected] ?

                        Comment


                          #42
                          Hello,

                          Yes. In this case if you are even unable to connect to gmail email smtp server. Unfortuanley we have reached the end of the support I'm able to provide. You have something on your network/router/PC that is blocking the connections on port 25 smtp to send outbound email.

                          You would need to continue to troubleshoot this on your own or contact a general IT professional in your area to help with unblocking this on your setup.

                          As we have tried to connect to the ninjatrader smtp server and we have tried google smtp server and niether was able to connect too.

                          Let me know if I can be of further assistance.

                          Comment


                            #43
                            Gmail uses port 587

                            Originally posted by Aithin View Post
                            Now I get the error:
                            Failed to connect to smtp.gmail.com

                            Do I leave the support email as [email protected] ?
                            Gmail uses port 587, not 25 for SMTP, and requires authentication.

                            Set the correct port and try checking the SSL box, even though gmail actually wants TLS. You may need to setup Port Triggering or even Port Forwarding in your router.

                            Comment


                              #44
                              Hello,

                              It also allows port 25. As I did a test before posintg and the default port also works.

                              You may have success with changing the port to 587. To try to get around whataever is blocking you.

                              Comment


                                #45
                                I just forwarded port 587, with no luck. I'm not really sure where to even look next?

                                What are some of the things that could possibly be blocking me?

                                Thanks

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by kempotrader, Today, 08:56 AM
                                0 responses
                                6 views
                                0 likes
                                Last Post kempotrader  
                                Started by kempotrader, Today, 08:54 AM
                                0 responses
                                4 views
                                0 likes
                                Last Post kempotrader  
                                Started by mmenigma, Today, 08:54 AM
                                0 responses
                                2 views
                                0 likes
                                Last Post mmenigma  
                                Started by halgo_boulder, Today, 08:44 AM
                                0 responses
                                1 view
                                0 likes
                                Last Post halgo_boulder  
                                Started by drewski1980, Today, 08:24 AM
                                0 responses
                                4 views
                                0 likes
                                Last Post drewski1980  
                                Working...
                                X