Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

New 5day or week high

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

    New 5day or week high

    It's been a very long time since I've worked on a strategy in NT so this is probably very basic. I looked through the manual. How would you create an entry condition that requires a new 5day high and just a new current day high?

    #2
    zachj, thanks for the post - the current day could be accessed per default via the CurrentDay.OHL indicator in NinjaScript - http://www.ninjatrader.com/support/h...nt_day_ohl.htm

    For the current week, you would need to custom code a condition to keep track of it - this is not inbuild standard but on our suggestion list for potential future enhancement.

    Comment


      #3
      Would I do something like..

      private double WeekHigh()

      {
      return (CurrentDayOHL().CurrentHigh[0] > PriorDayOHLC().PriorHigh[0] && CurrentDayOHL().CurrentHigh[0] > PriorDayOHLC().PriorHigh[1] && CurrentDayOHL().CurrentHigh[0] > PriorDayOHLC().PriorHigh[2] ........)
      }

      private void WeekHighMethod()
      {
      if (Close[0] > WeekHigh())
      {EnterLong()}
      }

      I think putting the PriorHigh[1] sends it back 2 days? And PriorHigh[2] is 3 days back.

      Comment


        #4
        zachj, the index you apply would be based on the bars, so would not refer to 1 / 2 days back but literally the bars of the series you're working on.

        To track you can start working for example with this snippet, it would reset the track on Monday for the new week -

        if (Time[0].DayOfWeek == DayOfWeek.Monday && Bars.SessionBreak)
        trackCurrHigh = High[0];

        if (High[0] > trackCurrHigh)
        trackCurrHigh = High[0];

        Comment


          #5
          I'm not understanding what that is doing and don't see anything in the manual about trackCurrHigh?

          I guess that is picking up the high starting from monday but that will do we no good if it's wed im trying to look back 5 trading days. I can't believe there is no way to have it recognize the day high say 3days back.

          What about creating and index 1
          Add(PeriodType.Day, 5); This would make a 5day bar I think.

          {
          if (Close[0] > Highs[1][0])
          {EnterLong()}
          }

          Comment


            #6
            zachj, correct you could add a daily series to the script as well and reference it. My code was custom and not taken from any manual, it would track the developing current weekly high but not on a rolling basis.

            Comment


              #7
              So when I add Index 1 as mentioned below, a 5day bar, what is the primary bar set at where can I see this or adjust the primary? Will it just be whatever chart time period I have pulled up, say I have a 5minute chart up. Or is this controllable in the backtest area? I wasn't quite understanding that from the manual.

              Comment


                #8
                Yes, correct - the primary would always be your charted / backtested main series.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                648 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                369 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                108 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                572 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                574 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X