Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

New Bar Alert

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

    New Bar Alert

    Is there an indicator that can alert me every time a new bar gets painted? This would be very useful since I'm using renko bars.

    #2
    Hello idude,

    Thank you for your note.

    I didn't see one in our user app share so I created a really simple one quickly - only one line of code needed. When you set an indicator to calculate On Bar Close, it runs once per bar, at the close as you might imagine. I simply created an indicator that plays a sound alert when the bar closes and the following bar opens.

    Here is a basic guideline of how to Import NinjaScripts.

    To import NinjaScripts you will need the original .zip file.

    To Import
    1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
    2. From the Control Center window select the menu File> Utilities> Import NinjaScript
    3. Select the downloaded .zip file
    4. NinjaTrader will then confirm if the import has been successful.

    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

    Once installed, you may add the indicator to a chart by:
    • Right click your chart > indicators > Select the Indicator from the list on the left > New > OK
    Please let me know if I can be of further assistance.

    Attached Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thank you so much, will try it.

      Comment


        #4
        Thanks for the BarCloseAlert indicator, simple and works well.
        I am writing to ask if there is a way to edit the code for the indicator to alert prior to bar close.
        In my case I need an alert for a 5min bar and a 15min bar close but both will not sound an alert at the same time. Also an alert 3 seconds prior to bar close would be very helpful

        Is there a way to edit the code so the alert sounds prior to bar close?

        Thank you very much for your assistance.

        Comment


          #5
          Hi, thanks for posting. Once the support team posts a simple example the example comes "As Is" and we will not be able to make further edits to it. To get intrabar alerts, you would need to set the indicator to run OnEachTick to read the DateTime.Now timestamp and trigger alerts based on conditions using this time stamp in real time. This would be one way to get an alert before the bar closes.

          Kind regards,
          -ChrisL
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Kate View Post
            Hello idude,

            Thank you for your note.

            I didn't see one in our user app share so I created a really simple one quickly - only one line of code needed. When you set an indicator to calculate On Bar Close, it runs once per bar, at the close as you might imagine. I simply created an indicator that plays a sound alert when the bar closes and the following bar opens.

            Here is a basic guideline of how to Import NinjaScripts.

            To import NinjaScripts you will need the original .zip file.

            To Import
            1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
            2. From the Control Center window select the menu File> Utilities> Import NinjaScript
            3. Select the downloaded .zip file
            4. NinjaTrader will then confirm if the import has been successful.

            Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

            Once installed, you may add the indicator to a chart by:
            • Right click your chart > indicators > Select the Indicator from the list on the left > New > OK
            Please let me know if I can be of further assistance.
            Is it possible to update this new bar alert indicator for the latest version of NT8 with editable alert sounds?
            Thanks

            Comment


              #7
              Originally posted by tradertom2012 View Post

              Is it possible to update this new bar alert indicator for the latest version of NT8 with editable alert sounds?
              Thanks
              Here is an update, two version updates one sound selection, two multiple audio conditions.
              As needed add new alerts.
              Enjoy.

              BarCloseAlertv05.zip

              Comment


                #8
                Thats awesome thank you very much.

                Comment


                  #9
                  Can i color and alert small body bars (open/close of 3 ticks or less) like Doji bars
                  Attached Files

                  Comment


                    #10
                    Hi, I am attempting to send an email alert on a new bar with the following:

                    Code:
                    SendMail("[email protected]", "New Bar Alert", "New Bar");
                    Code:
                    /* Alert Trades On Excecition New Bar*/
                    if (SoundsOn && NewBarAlert && SoundsAlert && IsFirstTickOfBar)
                    {
                    Alert("myAlertNewBar", Priority.High, "Bar Closed", AAlert, ARE, Brushes.Black, Brushes.Yellow);
                    PlaySound(AAlert);
                    SoundsAlert = false;
                    AlertA = 1;
                    SendMail("[email protected]", "New Bar Alert", "New Bar");
                    }
                    I had the ​'share services' set up and I can receive the test mail. Alert sounds are triggered, however, I did not receive emails for each new bar.
                    Last edited by ow_xo; 09-20-2023, 08:04 AM.

                    Comment


                      #11
                      Hello ow_xo,

                      Welcome to the NinjaTrader forums!

                      Note, the alerts and email would only be sent for real-time bar closes and are not sent in historical.

                      I've given this a test, and I am finding the call to SendMail() does appear to work correctly.


                      May I confirm that the Alert is appearing in the Alerts Log window? (This would confirm the code is being reached through the condition)


                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_ChelseaB View Post
                        Hello ow_xo,

                        Welcome to the NinjaTrader forums!

                        Note, the alerts and email would only be sent for real-time bar closes and are not sent in historical.

                        I've given this a test, and I am finding the call to SendMail() does appear to work correctly.


                        May I confirm that the Alert is appearing in the Alerts Log window? (This would confirm the code is being reached through the condition)

                        Hi Chelsea, it worked!
                        THank you very much!

                        Comment


                          #13
                          Hi,

                          Thank you so much for the bar close alert.

                          Please, is it possible to add 1 parameter which defines how many seconds before bar close will be the sound?

                          Jan

                          Comment


                            #14
                            Hello Jan,

                            Welcome to the NinjaTrader forums!

                            To achieve this you will need to add a 1 second series to the script with AddDataSeries().


                            Then run the logic in a condition requiring BarsInProgress to be 1.


                            A public int property can be added for the number of seconds.
                            [NinjaScriptProperty]
                            public int SecondsBeforeBarClose
                            { get; set; }

                            You can compare the datetime of the 1 second series to be equal to the primary series minus 30 seconds.

                            if (Times[1][0] == Times[0].AddSeconds(-30))



                            I am also including a link to a support article with helpful resources on getting started with C# and NinjaScript.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Hello Chelsea,

                              Thank you so much for the help :-). I did not expect so extensive answer.

                              BR,
                              Jan​

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by GwFutures1988, Today, 02:48 PM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by ScottWalsh, 04-16-2024, 04:29 PM
                              6 responses
                              30 views
                              0 likes
                              Last Post ScottWalsh  
                              Started by frankthearm, Today, 09:08 AM
                              10 responses
                              36 views
                              0 likes
                              Last Post frankthearm  
                              Started by mmenigma, Today, 02:22 PM
                              1 response
                              3 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by NRITV, Today, 01:15 PM
                              2 responses
                              9 views
                              0 likes
                              Last Post NRITV
                              by NRITV
                               
                              Working...
                              X