• 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

high and low choice ?

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

    high and low choice ?

    hi guys how it is possible to determine the high and low like in picture
    thankz at all

    #2
    Hello faustf, thanks for your note.

    The Swing indicator does a similar calculation. You can look at the source code of Swing through the NinjaScript editor. There is also a MAX and MIN methods. This post has a lot of information on getting the highest high over a period of bars:
    https://ninjatrader.com/support/foru...r-highest-high

    The same concept can be applied for the lowest low.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      thankz i look if is good for me

      Comment


        #4
        Hi I am looking for the sound alert option for this Swing Indicator. I wonder how may i be able to request some one to enable the Swing High / Low alert? Very much appreciated.

        Comment


          #5
          Hi cyberjames2019, thanks for your note.

          The Swing indicator has methods that you can use to get either the bar number of the latest swing or the price of the latest swing. See all the helper methods on the documentation page here:
          https://ninjatrader.com/support/help...nt8/?swing.htm
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Hello Chris,

            I am not sure how that is to be done to add the sound alert? It is something that I have to code it myself?

            Comment


              #7
              Hello cyberjames2019,

              Thanks for your reply and welcome to the NinjaTrader forums!

              If you wish to add a sound alert into the indicator itself, yes you would have to open the code and add the PlaySound() method. We do not provide coding services so if you would like that done for you we can provide a link to 3rd party programmers who can provide that service.

              An alternative you might want to test first would be to use "Chart Alerts" in NinjaTrader8 which allow you to configure alerts for the chart based on the applied price bars and indicators on the chart. In the case of the Swing Indicator, you could test to see if the current swing high value is not equal to the previous swing high value meaning the swing had changed which is what I suspect you are looking for. I'll post an example screenshot below of the alerts condition builder which is very similar to the strategy builder's nonprogramming interface.

              Here is the link to the Help guide for chart alerts: https://ninjatrader.com/support/helpGuides/nt8/?alerts.htm You'll want to review all of that section for help in understanding how to configure the alerts and the choices that you have.

              The example condition: Is the current bar of the SwingHigh not equal to the previous bar of the SwingHigh. The Swing low alert would be very similar except change the "indicator plot: to swing low.


              Click image for larger version

Name:	CJ-1.PNG
Views:	138
Size:	24.9 KB
ID:	1077369
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Thank you for your input. I am testing and exploring the chart alert.

                I came into a very strange situation that the alert will be disabled automatically? Each time I checked the enable box after awhile it will be disabled automatically. Could you please let me know why? and how to resolve it?

                Comment


                  #9
                  Hi cyberjames2019, thanks for your reply.

                  If your rearm type is set to Never then the alert will disable after it triggers. You can change it to OnBarClose, condition reversal, or a timer alternatively. This is covered in the Alert help guide section here:
                  https://ninjatrader.com/support/help...lertProperties


                  Chris L.NinjaTrader Customer Service

                  Comment


                    #10
                    Thank you every one I am able to test out some alerts. However for the alert on the Swing Low and Swing High I think I am not getting the correct alert. Hence I think the best is to code the PlaySound() method. Is there any source code reference that i can refer to?

                    Comment


                      #11
                      Hello, thanks for your reply.

                      This code uses the swing indicator to find the swing high values:

                      Code:
                      namespace NinjaTrader.NinjaScript.Indicators
                      {
                          public class SwingAlert : Indicator
                          {
                      
                              Swing MySwing;
                              double prevSwingHigh = 0;
                      
                              protected override void OnStateChange()
                              {
                                  if (State == State.SetDefaults)
                                  {
                                      ... //setup code here
                                  }
                                  else if (State == State.DataLoaded)
                                  {
                                      MySwing = Swing(5);
                                  }
                              }
                      
                              protected override void OnBarUpdate()
                              {
                                  if(CurrentBar < 5)
                                      return;
                      
                                  if(MySwing.SwingHigh[0] != prevSwingHigh)
                                  {
                                      prevSwingHigh = MySwing.SwingHigh[0];
                                      Draw.Dot(this, CurrentBar + "NewSwing", false, 0, prevSwingHigh, Brushes.Purple);
                                      PlaySound(@"C:\mySound.wav");
                                  }
                              }
                          }
                      }
                      The documentation page on PlaySound has an example of how to use it in a script:

                      https://ninjatrader.com/support/help...?playsound.htm

                      Chris L.NinjaTrader Customer Service

                      Comment


                        #12
                        Hi I would like to add the following into the attached CS file


                        PlaySound(@"\sounds\SwingHighEstablished.wav");

                        PlaySound(@"\sounds\SwingLowEstablished.wav");

                        May I know which lines are appropriate to add this code to alert the sound when a Swing High or Swing Low is drawn? I am not sure where exactly to insert. Thank you for your advice.
                        Attached Files

                        Comment


                          #13
                          Hi, thanks for your reply.

                          There's no need to modify the Swing source code for this. I attached a script that alerts on new swings. Place the script within Documents\NinjaTrader 8\bin\Custom\Indicators.
                          Attached Files
                          Chris L.NinjaTrader Customer Service

                          Comment


                            #14
                            Thank you so much! It works exactly what I am looking for.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by BatBart, Today, 01:24 PM
                            1 response
                            22 views
                            0 likes
                            Last Post NinjaTrader_Melissa  
                            Started by ezrakoper, Today, 03:05 PM
                            1 response
                            7 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by asmmbillah, Today, 02:23 PM
                            1 response
                            17 views
                            0 likes
                            Last Post NinjaTrader_Jesse  
                            Started by steveg, Today, 02:44 PM
                            1 response
                            9 views
                            0 likes
                            Last Post NinjaTrader_Heath  
                            Started by lightsun47, Today, 12:33 PM
                            1 response
                            14 views
                            0 likes
                            Last Post NinjaTrader_Jim  
                            Working...
                            X