Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Modify CurrentDayOHL

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

    Modify CurrentDayOHL

    Hello,
    Is there a way to modify the CurrentDayOHL indicator to just show or start at the session open, say from 9:30 est to 16:15 est?
    So it will plot any new highs or lows from the 9:30 open to the 16:15 close.

    Maybe it could be a seperate indicator so it could be laid over the existing CurrentDayOHL indictor for those who would like to see the overnight (Globex) highs and lows...at least until they match up.

    Thanks

    #2
    dwalls,

    You can just change your chart's session begin/end times to do this. Otherwise it is possible through custom coding on the indicator. As a last resort you could try contacting one of the 3rd party NinjaScript Consultants here if you don't want to do it yourself: http://www.ninjatrader.com/webnew/pa...injaScript.htm
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hello,
      is there a way how to modify the CurrentDayOHL indicator? I would like to add alerts to it. One alert to a high and one to a low?

      Thank you.
      Last edited by emuns; 07-30-2013, 11:07 AM.

      Comment


        #4
        Hello emuns,

        Thank you for your post.

        You can edit the CurrentDayOHL by going to the NinjaTrader Control Center > Tools > Edit NinjaScript > Indicator > select the CurrentDayOHL > OK > when the NinjaScript editor loads right click in the editor and select Save As > give the indicator a new name > now you can edit the indicator to your liking.
        Information on Alerts can be found at the following link: http://www.ninjatrader.com/support/h.../nt7/alert.htm

        It may be easier to create your own indicator and call the CurrentDayOHL() method in your indicator to create the alerts: http://www.ninjatrader.com/support/h...nt_day_ohl.htm

        Please let me know if I may be of further assistance.

        Comment


          #5
          Hello Patrick H.,
          thank you for your answer. I tried to do my own indicator but it doesn´t work and I don´t know what´s wrong. Could you help me please? I think that everything is done properly...

          #region Variables
          // Wizard generated variables
          privatestring alertFileHigh = @"eshigh.wav"; // Default setting for AlertFileHigh
          privatestring alertFileLow = @"eslow.wav"; // Default setting for AlertFileLow
          // User defined variables (add any user defined variables below)
          #endregion
          ///<summary>
          /// This method is used to configure the indicator and is called once before any bar data is loaded.
          ///</summary>
          protectedoverridevoid Initialize()
          {
          CalculateOnBarClose =
          false;
          }
          ///<summary>
          /// Called on each bar update event (incoming tick)
          ///</summary>
          protectedoverridevoid OnBarUpdate()
          {
          // Condition set 1
          if (Close[0] >= CurrentDayOHL().CurrentHigh[1])
          {
          PlaySound(alertFileHigh);
          }
          // Condition set 2
          if (Close[0] <= CurrentDayOHL().CurrentLow[1])
          {
          PlaySound(alertFileLow);
          }

          Thank you.

          Comment


            #6
            Hello emuns,

            Thank you for your response.

            Are you trying to access yesterday's OHLC? You are using a Bar Index of 1 to access the previous bar on the chart but this will not access yesterday's values.

            You will need to use PriorDayOHLC(): http://www.ninjatrader.com/support/h...r_day_ohlc.htm

            Please let me know if I may be of further assistance.

            Comment


              #7
              Hello Patrick,
              I´m trying to access today´s high/low. That´s why I use CurrentDayOHL.

              Comment


                #8
                Hello emuns,

                Thank you for your response.

                If you replace PlaySound(alertFileHigh); with PlaySound("Alert1.wav"); does the sound play?

                I tested this on my end with PlaySound("Alert1.wav"); and it did in fact work.

                Comment


                  #9
                  Hello Patrick,
                  unfortunately it doesn´t work

                  Comment


                    #10
                    Hello dwalls,

                    Thank you for your response.

                    Do you see any error messages in the Log tab of the NinjaTrader Control Center? If so, what do these errors report?

                    Do you hear other sounds in NinjaTrader? Such as if you disconnect form your data feed provider and re-connect do your hear the connection sound?

                    I look forward to your response.

                    Comment


                      #11
                      Hello Patrick,
                      I can hear other sounds in NT.
                      There is an error message in the Log tab:
                      Error on calling 'OnBarUpdate' method for indicator 'CurrentDayHLAlert3' on bar 0: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

                      Comment


                        #12
                        Hello emuns,

                        Thank you for your response.

                        Can you attach the full indicator to your response?

                        You will find the indicator located in the following directory on your PC: (My) Documents\NinjaTrader 7\bin\Custom\Indicator

                        I look forward to your response.
                        Last edited by NinjaTrader_PatrickH; 07-31-2013, 02:35 PM.

                        Comment


                          #13
                          Of course. Here it is.
                          Attached Files

                          Comment


                            #14
                            Hello emuns,

                            Thank you for your response.

                            I was able to get your indicator to work by adding the following line to the beginning of the OnBarUpdate() method:
                            Code:
                            			if(CurrentBar <= 1)
                            				return;
                            For information on ensuring you have enough bars before accessing them please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=3170

                            Please let me know if I may be of further assistance.

                            Comment


                              #15
                              Hello Patrick,
                              thanks a lot for help. It is working now! But I have another problem: rearming. I think that the best way would be once per bar but I´m not sure if it is possible.

                              Thanks again.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by gravdigaz6, Today, 11:40 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post gravdigaz6  
                              Started by MarianApalaghiei, Today, 10:49 PM
                              3 responses
                              9 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by XXtrader, Today, 11:30 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post XXtrader  
                              Started by love2code2trade, Yesterday, 01:45 PM
                              4 responses
                              28 views
                              0 likes
                              Last Post love2code2trade  
                              Started by funk10101, Today, 09:43 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post funk10101  
                              Working...
                              X