Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

day before yesterday or x days ago high/low line

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

    day before yesterday or x days ago high/low line

    Hi guys!

    Today and yesterday high/low is so simply, but how can i draw day before yesterday or even 5 days ago high/low line....or for example weekly open line?
    /I'd like to see it on only todays charts/

    Where can I find the solution?
    thx

    w.

    #2
    Hello wokitun,

    Thank you for your post.

    You will need to use Bars.GetDayBar() to pull this information: http://www.ninjatrader.com/support/h.../getdaybar.htm

    For building plots I recommend reviewing our tutorials section: http://www.ninjatrader.com/support/h...ndicators2.htm

    Please let me know if you have any questions.

    Comment


      #3
      Hi NinjaTrader_PatrickH!

      / I'd like to get 3 days ago high price/
      when i put this line in my code...
      Print("The prior trading day's high is: " + Bars.GetDayBar(3).High.ToString());

      i got an error message....
      Error on calling 'OnBarUpdate' method for indicator 'my_indicator' on bar 0: Object reference not set to an instance of an object.

      I have 365 days bars...

      thx
      w.

      Comment


        #4
        Hello W.,

        Thank you for your response.

        Please ensure the following check is performed before the print statement:
        Code:
        [B]if (Bars.GetDayBar(3) != null)[/B]
        {
        Print("The prior trading day's high is: " + Bars.GetDayBar(3).High.ToString());
        }
        Please let me know if I may be of further assistance.

        Comment


          #5
          Thx

          It's working....

          And how can i get weekly or previous weekly open price?
          Should i see what day of the week is...etc? Or is there anything easier way?

          thanks again

          w.

          Comment


            #6
            Hello W.

            Thank you for your response.

            It is possible to check the week, date or even month through DateTime. Such as Time[0].DayOfWeek.

            For information on DayOfWeek please visit the following link: http://www.ninjatrader.com/support/h.../dayofweek.htm

            You can also add an additional time frame to your code for Weekly bars. For information on adding another time frame to your code please visit the following link: http://www.ninjatrader.com/support/h...nstruments.htm

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

            Comment


              #7
              Thank you...
              I'll check it out...

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              566 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              330 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
              547 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              548 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X