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

1st Hour High/Low

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

    #16
    If you require the high and low of the session, why don't you just use the indicator CurrentDayOHL ?

    Help Guide - http://www.ninjatrader-support.com/H...entDayOHL.html
    RayNinjaTrader Customer Service

    Comment


      #17
      Hi,

      Where do I use it? I try declaring it in variables section and I still get "The name 'CurrentOHL' does not exist in the current context" I also tried placing it under ONbarUpdate and same problem occurs.

      Thanks

      Comment


        #18
        So that I am on the same page as you...

        - What do you want to do, have an indicator that plots the day's highest high and lowest low?
        - If yes, there is no need to create a custom indicator, just open a chart and add the CurrentDayOHL indicator.
        - Is there something else you want to do? I yes, please let me know and I can provide additional assistance.
        RayNinjaTrader Customer Service

        Comment


          #19
          Ray,

          I want to plot the highest high and lowest low of the first 30 minutes of the trading session. For this I would need a property that can look at the highs/lows from 930am EST till 1000am EST. Then plot the highest high and lowest low from that period.

          Thanks

          Comment


            #20
            Thanks for the clarification.

            Then you will have to create a custom indicator for sure. In english...

            If the time is between your session start time and session start time + 30 mins plot the value of the current high.

            Same for current low.

            To access the current high or low:

            CurrentDayOHL().CurrentHigh[0]
            CurrentDayOHL().CurrentLow[0]
            RayNinjaTrader Customer Service

            Comment


              #21
              How do I use this?

              I followed the example in the help filebut when I compile, I get "The name 'CurrentOHL' does not exist in the current context"

              Comment


                #22
                Rename CurrentOHL to CurrentDayOHL(as suggested by Ray's post). We will fix the bug in the docs with next update.

                Comment


                  #23
                  Hi

                  I get the following error:

                  An object reference is required for the nonstatic field, method, or property 'NinjaTrader.Indicator.Indicator.CurrentDayOHL()' Indicator\OpenRange.cs 28 20

                  Comment


                    #24
                    Here is partial code


                    if (currentDate != Time[0].Date)//if new day
                    {
                    pHigh = 0; // re-initialize PeriodHigh,PeriodLow for the new day
                    pLow = 9999;
                    }

                    if (ToTime(Time[0]) > 93000 && ToTime(Time[0]) < 100000)
                    {
                    if (High[0] > pHigh) { pHigh = CurrentDayOHL().CurrentHigh[0] ; }
                    if (Low[0] < pLow) { pLow = CurrentDayOHL().CurrentLow[0] ;}

                    PeriodHigh.Set(PHigh);
                    PeriodLow.Set(PLow);
                    }

                    Comment


                      #25
                      - I suppose you are on latest NT6R2, no?
                      - could you please the code line which causes the trouble (click on the error message and you'll see)? (edit: disregard, since you just posted)

                      Thanks

                      Comment


                        #26
                        Just looking through this thread, it appears over complicated. Would the following not do the job? - in OnBarUpdate()

                        if (ToTime(Time[0]) == 100000)
                        {
                        pHigh = CurrentDayOHL().CurrentHigh[0];
                        pLow = CurrentDayOHL().CurrentLow[0];
                        }

                        if (ToTime(Time[0]) >= 100000)
                        {
                        periodHigh.Set(pHigh);
                        periodLow.Set(pLow);
                        }

                        There would be nothing plotted until 1000hrs, then you will get the highest and lowest price for the day so far up to 1000hrs, plotted as a straight line for the rest of the day. I think that is what is being attempted, or maybe I misunderstood something.

                        MJT

                        Comment


                          #27
                          Yes, that would work.
                          RayNinjaTrader Customer Service

                          Comment


                            #28
                            MJT,

                            That worked. It always seem easier after the problem is solved. Thank you so much.

                            Ray
                            Also, are there any examples to code this similar strategy to be used in Market Analyzer? When close > Phigh, then flash Green.
                            When close < Plow, then flash Red.

                            THanks again

                            Comment


                              #29
                              You would have to code a new indicator. I would code it and set the indicator plot value to > 0 when condition A is true, < 0 when condition B is true.

                              Then you can add this indicator to the Market Analyzer and set color conditions based on the indicator value.
                              RayNinjaTrader Customer Service

                              Comment


                                #30
                                1st hour high/low

                                I just stumbled across this post. CurrentDayOHL would not work if the chart begins at 12:00am. If you truly want only the 1st hour after the market opens try:

                                private double Hour1High =0.0;
                                private double Hour1Low =0.0;

                                OnBarUpdate...

                                if (currentDate != Time[0].Date)
                                Hour1High = 0;
                                Hour1Low = 9999;

                                if (ToTime(Time[0]) >= 93000 && ToTime(Time[0]) < 103000)
                                {
                                if (High[0] > Hour1High)
                                Hour1High = High[0];
                                if (Low[0] < Hour1Low)
                                Hour1Low = Low[0];
                                }

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Gerik, Today, 09:40 AM
                                2 responses
                                6 views
                                0 likes
                                Last Post Gerik
                                by Gerik
                                 
                                Started by RookieTrader, Today, 09:37 AM
                                2 responses
                                11 views
                                0 likes
                                Last Post RookieTrader  
                                Started by alifarahani, Today, 09:40 AM
                                1 response
                                7 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Started by KennyK, 05-29-2017, 02:02 AM
                                3 responses
                                1,285 views
                                0 likes
                                Last Post NinjaTrader_Clayton  
                                Started by AttiM, 02-14-2024, 05:20 PM
                                11 responses
                                186 views
                                0 likes
                                Last Post NinjaTrader_ChelseaB  
                                Working...
                                X