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

Average Daily Range on a 5mn chart

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

    Average Daily Range on a 5mn chart

    Hi,

    I am looking for an indicator that displays the Standard Moving Average X periods of the Daily Range (High-Low) in a x minutes chart. Has anybody already coded such an indicator?

    Thanks.

    JM

    #2
    Hello,


    Multi-timeframes are not supported in indicators generally, however because you are calculating daily data you can access the CurrentDayOHL() indicator and calculate it with those values.

    Here is a link that may help:
    DenNinjaTrader Customer Service

    Comment


      #3
      Thank you

      Thank you Ben. Just wondering:

      Let's imagine it is 10 am and I have 5mn bar chart :

      if
      CurrentDayOHL().CurrentLow[0]
      is the current day low at 10 am

      then

      CurrentDayOHL().CurrentLow[1]
      is the current day low
      at 9:55am, right?

      If so, how can I get the low of the day before?

      Thank you.
      Last edited by Jean-Marc-Molina; 09-30-2008, 09:49 AM.

      Comment


        #4
        Hello,



        Use PriorDayOHLC() to get yesterdays:
        DenNinjaTrader Customer Service

        Comment


          #5
          Thank you

          I need the Average range for the last 14 days. I'll try to use these routines.

          Comment


            #6
            Hello,


            You will want to do something like this:

            PriorDayOHLC().PriorLow[GetBar(new DateTime(2008, 9, 30, 9, 0))]

            You will need to keep changing the integers.

            Here are some links that will help:
            Represents an instant in time, typically expressed as a date and time of day.




            This link has an example on how to use DateTime():
            DenNinjaTrader Customer Service

            Comment


              #7
              I believe I now have what I need to proceed. Thank you very much Ben.

              Comment


                #8
                How to decrement DateTime

                Hi Ben, I need this function too, and I am dazed and confused learning .NET for the first time.

                Any chance you could suggest an intelligent way to change the integers without ending up with negative numbers? Or trying to guess the days in a month, etc?

                I mean, your examples and links are great, but I'm just confused by the constraints of going backwards. I'm sorry if the examples contain the explanation and I just can't see it...

                And the .NET docs are not really ringing a bell. The Today and Now properties are great, but how do you ask for Yesterday?

                Sorry again if it's obvious...
                Last edited by hanlen; 11-09-2008, 05:00 PM. Reason: don't even know how to ask the question!

                Comment


                  #9
                  I think this what I was after

                  I guess this is the answer to how to decrement DateTime:

                  DateTime yesterday = DateTime.Now.AddDays( -1 );

                  Sadly, I won't have time to test this for a week or so, but it's legit .NET so I expect it will work.

                  Thanks !

                  Comment


                    #10
                    A simplification?

                    In my naivete I thought that PriorDayOHLC was a method that referred to a trading day. I now believe it refers only to a session.

                    If that's the case, I would record here Raymond Deux's initial suggestions that may be simpler for some cases:


                    I hope someone finds this useful

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by adeelshahzad, Today, 03:54 AM
                    4 responses
                    25 views
                    0 likes
                    Last Post adeelshahzad  
                    Started by merzo, 06-25-2023, 02:19 AM
                    10 responses
                    823 views
                    1 like
                    Last Post NinjaTrader_ChristopherJ  
                    Started by frankthearm, Today, 09:08 AM
                    5 responses
                    17 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    43 views
                    0 likes
                    Last Post jeronymite  
                    Started by yertle, Today, 08:38 AM
                    5 responses
                    16 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Working...
                    X