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 CarlTrading, 03-31-2026, 09:41 PM
              1 response
              152 views
              1 like
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, 04-01-2026, 02:41 AM
              0 responses
              89 views
              1 like
              Last Post CarlTrading  
              Started by CaptainJack, 03-31-2026, 11:44 PM
              0 responses
              131 views
              2 likes
              Last Post CaptainJack  
              Started by CarlTrading, 03-30-2026, 11:51 AM
              0 responses
              127 views
              1 like
              Last Post CarlTrading  
              Started by CarlTrading, 03-30-2026, 11:48 AM
              0 responses
              107 views
              0 likes
              Last Post CarlTrading  
              Working...
              X