Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changes to CurrentDayOHL indicator

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

    #16
    chinapassage,

    Try the following code with the NT CurrentDayOHL indicator. It will give you the High & Low starting with the night session. As for the Open, you have the option to change it to any time you need. I trade futures, but like to keep tabs when the market opens, so mine is CST, 8:30 am.

    Hope this this is what you need.

    Code:
    if (currentDate != Bars.GetTradingDayFromLocal(Time[0]) || currentOpen == double.MinValue)
                {
                    currentOpen     =     Open[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))]; 
                    currentHigh     =     High[0];
                    currentLow        =    Low[0];
                    sameDay         =   false;
                }
    
                currentHigh     =     Math.Max(currentHigh, High[0]);
                currentLow        =     Math.Min(currentLow, Low[0]);
                
                if(ToTime(Time[0]) < ToTime(8,30,0))
                {
                    currentOpen = Open[0];
                    PlotColors[0][0] = Color.Transparent;
                }
                
                if(currentDate == Bars.GetTradingDayFromLocal(Time[0]) && ToTime(Time[0]) >= ToTime(8,30,0))
                    currentOpen = Close[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];

    Comment


      #17
      Thanks,
      i got it to work on a minute chart good... but when i stick it with the rotation bar type charts it looks at the bar instead of the "time" ... if anyone happens to know what needs to be changed in this code so that i can select the exact tick for a given time would be great thx:


      i have attached the indicator below if someone needed to see the code it was to big to type into here
      Attached Files

      Comment


        #18
        Hello chinapassage,

        If you are running this on a minute chart the time (Time[0]) will refer to the close time of that bar. For example if the market opens at 9:00, then the first bar close will be at 9:01 (after the first minute has elapsed and the bar has closed).

        If you want to find the first tick of a bar or a session, you will need to add a 1 tick data series to your script. (historically, 1 minute data does not have tick information)

        Below is a link to the help guide on adding a data series.
        http://www.ninjatrader.com/support/h...s/nt7/add3.htm

        BarsInProgress allows you to see which data series is triggering OnBarUpdate.
        http://www.ninjatrader.com/support/h...inprogress.htm

        Times (plural) - allows you to check the time of a specific series. (Times[barsinprogress index][bars ago index])
        http://www.ninjatrader.com/support/h.../nt7/times.htm

        Also, below is a link to how the bars in the data series are indexed when there are multiple data series.
        http://www.ninjatrader.com/support/h...nstruments.htm
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X