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

    #61
    Hello,

    Can you please post your full! code so that I may check it and run it on my side. If your able to send a test message our you should also be able to send out the email through NinjaScript though at this point.

    Thank You.

    Comment


      #62
      I think I figured out what was wrong ... I had the } in the wrong place. After editing the code I put the } before the "properties" line generated by the wizard.

      It seems to be working now.

      Comment


        #63
        Hi,

        I could not get the test mail working with my ISP's standard smtp server. Also not with the gmail or yahoo accounts. Coded my own mail-sending function. But would be easier if NT's own function worked well.

        Comment


          #64
          Hello,

          What specific error did you get with the default NT email with the google setup? Can I get the output of the trace file when you attempt to send the email.

          My Documents->NinjaTrader 7->trace->todays date.txt and the exception message when you attempt to send mail.

          I look forward to assisting you further.

          Comment


            #65
            Originally posted by NinjaTrader_Brett View Post
            Hello,

            What specific error did you get with the default NT email with the google setup? Can I get the output of the trace file when you attempt to send the email.

            My Documents->NinjaTrader 7->trace->todays date.txt and the exception message when you attempt to send mail.

            I look forward to assisting you further.
            Hi,

            The weird thing is that there is no execption in the trace file.
            When I use the "Test" function NT slows down for a while and gives error about failed to send. But no entries in trace-file on either of the 2 PC's I tried it on.

            Comment


              #66
              Hello,

              And what specific error do you get again.

              Comment


                #67
                Its like this


                Also in the logs, but not trace-file

                Comment


                  #68
                  Hello,

                  Can you please try one more with these google settings.

                  For NinjaTrader replace with your own username and password. make sure to not put in @gmail.com at the end in the username.

                  I look forward to assisting you further.

                  Attached Files

                  Comment


                    #69
                    also, make sure you set these settings and then click ok. THen go back in to teest to see if the email is set. You must click ok for the settings to go into place before testing email send.

                    Comment


                      #70
                      Hi,

                      The problem was with the OK and then going once more to options and then clicking test. Got it to work also with my local ISP now.
                      Thank you for your patience and help!

                      Comment


                        #71
                        Excellent glad to hear!

                        Comment


                          #72
                          The test button is possibly not most intuitionally placed, in web-forms u usually test first and then save, but technically the email app works good.

                          Comment


                            #73
                            New Bar sound Alert

                            Hi
                            I have been searching for a script that will alert a sound each time new bar being created.
                            I gave up for looking one, and this thread inspired me to write one, though it is a simple one but I am going to post it below so others who searches one will find one.
                            It doesn't send an email but this thread answers for a need to that.
                            The alert is for %AUDUSD and $EURUSD, it is easy to modify to match whatever is needed, it both makes the sound and prints an alert with a message, I recorded the sounds my self so I know which instrument it belongs to.
                            I generated the code with NJScript wizard and it puts additional Plot indicator space, I minimized it to the minimum so it does not disturb me or the visual place, in case someone will use it and will modify the script so the plot will not be displayed on the chart, please post the script back, thanks.
                            Copy/Paste (I recorded my one sounds
                            ----------------------------------------------------------------------------------

                            #region Using declarations
                            using System;
                            using System.ComponentModel;
                            using System.Diagnostics;
                            using System.Drawing;
                            using System.Drawing.Drawing2D;
                            using System.Xml.Serialization;
                            using NinjaTrader.Cbi;
                            using NinjaTrader.Data;
                            using NinjaTrader.Gui.Chart;
                            #endregion

                            // This namespace holds all indicators and is required. Do not change it.
                            namespace NinjaTrader.Indicator
                            {
                            /// <summary>
                            /// Whenever new bar is created, sound is being played
                            /// </summary>
                            [Description("Whenever new bar is created, sound is being played")]
                            public class NerBarAlerSound : Indicator
                            {
                            #region Variables
                            // Wizard generated variables
                            private string currencyname0 = @"Instrument.FullName"; // Default setting for Currencyname0
                            // User defined variables (add any user defined variables below)
                            private string alertsound = "EUR.wav";
                            #endregion

                            /// <summary>
                            /// This method is used to configure the indicator and is called once before any bar data is loaded.
                            /// </summary>
                            protected override void Initialize()
                            {
                            Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Dot, "NewBarPrice"));
                            Overlay = false;
                            }

                            /// <summary>
                            /// Called on each bar update event (incoming tick)
                            /// </summary>
                            protected override void OnBarUpdate()
                            {
                            // Use this method for calculating your indicator values. Assign a value to each
                            // plot below by replacing 'Close[0]' with your own formula.
                            Plot0.Set(Close[0]);
                            string alertsound = "EUR.wav";
                            if (FirstTickOfBar)
                            {
                            if (Instrument.FullName == "$AUDUSD")
                            {
                            alertsound = "AUD.wav";
                            }
                            Print("NewBar - "+ Instrument.FullName);
                            Alert("NewBarAlert", NinjaTrader.Cbi.Priority.High, "New Bar Created for - " + Instrument.FullName, alertsound, 10, Color.Black, Color.Yellow);
                            }
                            }

                            #region Properties
                            [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
                            [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
                            public DataSeries Plot0
                            {
                            get { return Values[0]; }
                            }

                            [Description("Full Currency Chart Name")]
                            [GridCategory("Parameters")]
                            public string Currencyname0
                            {
                            get { return currencyname0; }
                            set { currencyname0 = value; }
                            }
                            #endregion
                            }
                            }

                            #region NinjaScript generated code. Neither change nor remove.
                            // This namespace holds all indicators and is required. Do not change it.
                            namespace NinjaTrader.Indicator
                            {
                            public partial class Indicator : IndicatorBase
                            {
                            private NerBarAlerSound[] cacheNerBarAlerSound = null;

                            private static NerBarAlerSound checkNerBarAlerSound = new NerBarAlerSound();

                            /// <summary>
                            /// Whenever new bar is created, sound is being played
                            /// </summary>
                            /// <returns></returns>
                            public NerBarAlerSound NerBarAlerSound(string currencyname0)
                            {
                            return NerBarAlerSound(Input, currencyname0);
                            }

                            /// <summary>
                            /// Whenever new bar is created, sound is being played
                            /// </summary>
                            /// <returns></returns>
                            public NerBarAlerSound NerBarAlerSound(Data.IDataSeries input, string currencyname0)
                            {
                            if (cacheNerBarAlerSound != null)
                            for (int idx = 0; idx < cacheNerBarAlerSound.Length; idx++)
                            if (cacheNerBarAlerSound[idx].Currencyname0 == currencyname0 && cacheNerBarAlerSound[idx].EqualsInput(input))
                            return cacheNerBarAlerSound[idx];

                            lock (checkNerBarAlerSound)
                            {
                            checkNerBarAlerSound.Currencyname0 = currencyname0;
                            currencyname0 = checkNerBarAlerSound.Currencyname0;

                            if (cacheNerBarAlerSound != null)
                            for (int idx = 0; idx < cacheNerBarAlerSound.Length; idx++)
                            if (cacheNerBarAlerSound[idx].Currencyname0 == currencyname0 && cacheNerBarAlerSound[idx].EqualsInput(input))
                            return cacheNerBarAlerSound[idx];

                            NerBarAlerSound indicator = new NerBarAlerSound();
                            indicator.BarsRequired = BarsRequired;
                            indicator.CalculateOnBarClose = CalculateOnBarClose;
                            #if NT7
                            indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                            indicator.MaximumBarsLookBack = MaximumBarsLookBack;
                            #endif
                            indicator.Input = input;
                            indicator.Currencyname0 = currencyname0;
                            Indicators.Add(indicator);
                            indicator.SetUp();

                            NerBarAlerSound[] tmp = new NerBarAlerSound[cacheNerBarAlerSound == null ? 1 : cacheNerBarAlerSound.Length + 1];
                            if (cacheNerBarAlerSound != null)
                            cacheNerBarAlerSound.CopyTo(tmp, 0);
                            tmp[tmp.Length - 1] = indicator;
                            cacheNerBarAlerSound = tmp;
                            return indicator;
                            }
                            }
                            }
                            }

                            // This namespace holds all market analyzer column definitions and is required. Do not change it.
                            namespace NinjaTrader.MarketAnalyzer
                            {
                            public partial class Column : ColumnBase
                            {
                            /// <summary>
                            /// Whenever new bar is created, sound is being played
                            /// </summary>
                            /// <returns></returns>
                            [Gui.Design.WizardCondition("Indicator")]
                            public Indicator.NerBarAlerSound NerBarAlerSound(string currencyname0)
                            {
                            return _indicator.NerBarAlerSound(Input, currencyname0);
                            }

                            /// <summary>
                            /// Whenever new bar is created, sound is being played
                            /// </summary>
                            /// <returns></returns>
                            public Indicator.NerBarAlerSound NerBarAlerSound(Data.IDataSeries input, string currencyname0)
                            {
                            return _indicator.NerBarAlerSound(input, currencyname0);
                            }
                            }
                            }

                            // This namespace holds all strategies and is required. Do not change it.
                            namespace NinjaTrader.Strategy
                            {
                            public partial class Strategy : StrategyBase
                            {
                            /// <summary>
                            /// Whenever new bar is created, sound is being played
                            /// </summary>
                            /// <returns></returns>
                            [Gui.Design.WizardCondition("Indicator")]
                            public Indicator.NerBarAlerSound NerBarAlerSound(string currencyname0)
                            {
                            return _indicator.NerBarAlerSound(Input, currencyname0);
                            }

                            /// <summary>
                            /// Whenever new bar is created, sound is being played
                            /// </summary>
                            /// <returns></returns>
                            public Indicator.NerBarAlerSound NerBarAlerSound(Data.IDataSeries input, string currencyname0)
                            {
                            if (InInitialize && input == null)
                            throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

                            return _indicator.NerBarAlerSound(input, currencyname0);
                            }
                            }
                            }
                            #endregion
                            ---------------------------------------

                            Comment


                              #74
                              Hello mikenj,

                              Welcome to the NinjaTrader forums and thank you for sharing this script. Feel free to export the source code in a .zip file and post to the file sharing section.
                              Ryan M.NinjaTrader Customer Service

                              Comment


                                #75
                                Is there a "new bar" indicator with email alert?

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by futtrader, 04-21-2024, 01:50 AM
                                4 responses
                                41 views
                                0 likes
                                Last Post futtrader  
                                Started by Option Whisperer, Today, 09:55 AM
                                1 response
                                11 views
                                0 likes
                                Last Post bltdavid  
                                Started by port119, Today, 02:43 PM
                                0 responses
                                3 views
                                0 likes
                                Last Post port119
                                by port119
                                 
                                Started by Philippe56140, Today, 02:35 PM
                                0 responses
                                4 views
                                0 likes
                                Last Post Philippe56140  
                                Started by 00nevest, Today, 02:27 PM
                                0 responses
                                2 views
                                0 likes
                                Last Post 00nevest  
                                Working...
                                X