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

Alert on new bar?

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

    Alert on new bar?

    I trade with longer term tick bars, where it takes usually 15 to 30 minutes to complete a bar. I often find myself checking the chart, waiting on the bar to close before I take action. It would be nice if I didn't have to watch, if I could just check back after the bar completes.

    Is there an indicator that will sound an audible alert on the close of the bar? If not, what would be the best way to create one?

    Thanks!

    #2
    Style,

    Yes, this is possible.

    Just create a new Indicator using Tools > Edit NinjaScript > Indicator, make sure CalculateOnBarClose = true, then add the following code to OnBarUpdate()


    Code:
            protected override void Initialize()
            {
                Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
                Overlay				= true;
            }
    
            protected override void OnBarUpdate()
            {
    			Alert("Bar CLOSED!", NinjaTrader.Cbi.Priority.High, "Bar CLOSED!", "Alert1.wav", 10, Color.Red, Color.Yellow);
            }
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Works like a charm. Thanks Adam!

      Comment


        #4
        Hello,
        I'm new to Ninjatrader so please excuse my newbie slowness in figuring this out. I'm also looking for an alert at the close of a tick bar. When following these instructions "Tools > Edit NinjaScript > Indicator" I have come to the point where I have to choose the indicator to modify. Corrrect? If so which one should I choose? Or do I build one from scratch?

        Comment


          #5
          Jim P,

          I am happy to assist you.

          The code I posted in post number 2 will work for you. For future reference, you can go to Tools > New NinjaScript > Indicator then just paste this code into your OnBarUpdate() method. However, Ill just attach this indicator below. To import it, go to Files > Utilities > Import NinjaScript.

          Please let me know if I may assist further.
          Attached Files
          Adam P.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by JIm P View Post
            Hello,
            I'm new to Ninjatrader so please excuse my newbie slowness in figuring this out. I'm also looking for an alert at the close of a tick bar. When following these instructions "Tools > Edit NinjaScript > Indicator" I have come to the point where I have to choose the indicator to modify. Corrrect? If so which one should I choose? Or do I build one from scratch?
            Create a new indicator.

            Comment


              #7
              MACD CrossOver Alert

              Hi there. I'm not sure if I'm in the right forum, but i'd like to know if there's a custom indicator to get an Alert when there's a MACD crossover? I tried searching, but came up empty. Thoughts?

              Comment


                #8
                MACD w/ Alerts

                bbelliveau,

                I am happy to assist you.

                Generally, we do not do custom programming here at NinjaTrader however you are in luck. I have previously created an indicator like this. Please find it attached.

                Please let me know if I may assist further.
                Attached Files
                Adam P.NinjaTrader Customer Service

                Comment


                  #9
                  SWEET! Thanks. I will try it out over the weekend!

                  Comment


                    #10
                    bbelliveau,

                    You will only get alerts in Market Replay or on live data with this indicator through the Alerts window. This is located in File > New > Alerts. It will play an alert sound and display some text in this window.

                    If what you meant was a signal such as a color change or a drawn object, such as an arrow, this is different.

                    Please let me know if I can assist further.
                    Adam P.NinjaTrader Customer Service

                    Comment


                      #11
                      No... sound alert is perfect!

                      Comment


                        #12
                        Thanks for the help Adam.

                        Comment


                          #13
                          Hello Adam,
                          Just wondering how/if I can change the alert to a different sound. Can I import different sounds for this indicator or would I have to create the indicator from scratch?

                          Comment


                            #14
                            Jim P,

                            Sounds are located in C:\Program Files (x86)\NinjaTrader 7\sounds

                            You can change the code by going to Tools > Edit NinjaScript > Select the indicator, then change the line :

                            Alert("Bar CLOSED!", NinjaTrader.Cbi.Priority.High, "Bar CLOSED!", "Alert1.wav", 10, Color.Red, Color.Yellow);

                            Where it says "Alert1.wav" to whatever you want in the Sounds directory. Afterwards, hit the compile button in the top toolbar. Using custom sounds is not supported but you can try adding a sound in there in .wav format.

                            Please let me know if I can assist further.
                            Adam P.NinjaTrader Customer Service

                            Comment


                              #15
                              Great! Thank you.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by RubenCazorla, Today, 09:07 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post RubenCazorla  
                              Started by BarzTrading, Today, 07:25 AM
                              2 responses
                              28 views
                              1 like
                              Last Post BarzTrading  
                              Started by devatechnologies, 04-14-2024, 02:58 PM
                              3 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by tkaboris, Today, 08:01 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post tkaboris  
                              Started by EB Worx, 04-04-2023, 02:34 AM
                              7 responses
                              165 views
                              0 likes
                              Last Post VFI26
                              by VFI26
                               
                              Working...
                              X