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

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 Kaledus, Today, 01:29 PM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by frankthearm, Yesterday, 09:08 AM
              13 responses
              45 views
              0 likes
              Last Post frankthearm  
              Started by PaulMohn, Today, 12:36 PM
              2 responses
              16 views
              0 likes
              Last Post PaulMohn  
              Started by Conceptzx, 10-11-2022, 06:38 AM
              2 responses
              55 views
              0 likes
              Last Post PhillT
              by PhillT
               
              Started by yertle, Yesterday, 08:38 AM
              8 responses
              37 views
              0 likes
              Last Post ryjoga
              by ryjoga
               
              Working...
              X