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

x-day range on intraday chart without using multitimeframe?

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

    x-day range on intraday chart without using multitimeframe?

    Hi,

    1) I wonder if it is possible to find MIN and MAX of x-last days but using intraday chart only.

    It means to recalculate BARSBACK and START parameters from days to intraday bars for this function MAX(High, BARSBACK)[START];

    2) additionaly find 1 day ago min/max, 2 days ago min/max, 3 days ago min max to be able to calculate 3-days ATR afterwards (or generally n-day ATR on intraday chart).

    Generally to be able to calculate number of bars between dates etc.
    Can you guide me? I don't want to use additional daily series due to known sync complications.

    Thank you
    Peter

    #2
    Hello PeterCherry,

    Thank you for your post and welcome to the forums

    Yes, you would want to use PriorDayOHLC() to get those values from the previous days.

    PriorDayOHLC().PriorLow[int barsAgo]

    http://www.ninjatrader.com/support/h...r_day_ohlc.htm
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Of course I know, I have read many similar posts. But I wrote 2 different questions above.

      Question 1 is about recalculation of 5-days into x-intraday bars etc.
      Question 2 is about finding 2 or 3 or n-days ago min/max.
      And general question is about working with dates and bar numbers.

      Regards
      Peter

      Comment


        #4
        Peter,

        Thank you for the clarification.

        Question 1 -
        While you can use MIN or MAX, when these get implemented they will be using the intraday bars and you would need to calculate the the previous bars for the different days back and the PriorDayOHLC.

        Meaning, that if you use a 1 minute series with MIN(PriorDayOHLC.PriorOpen, 20)[0]
        It is going to get the last 20, 1 minute bars and not the prior days.

        Question 2-
        same scenario as above. You will need to calculate for the different days


        General Question for Date and Time -
        This is dependent on the session template being loaded for the instrument. You can then extrapolate from that to basic math to calculate the number of bars between dates.

        This should be what you are looking for -
        http://www.ninjatrader.com/support/h...xtbeginend.htm
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Sample indicators

          There are a few sample indicators that use N-bar daily highs and lows calculated from intraday data. The most important thing, if you wish to use intraday data is that you need to use the correct session template for each instrument - best open all charts with the session template <instrument settings>. With the correct session template, the indicator can then scan the data from the beginning until the end of the trading day and retrieve the daily high or low. With specific session templates it is even possible to retrieve the high and low of the regular session.

          Sample indicator 1 - CurrentDayOHL with Average Daily Range

          The indicator calculates the average daily range for the last 10 and 20 days (default settings) from intraday data. The ADR can be displayed for the full session or the regular session. For the regular session ADR, a specific session template is required, which subdivides the full session into night session, regular session and evening session.

          The indicator can be found here (open source):



          The indicator is shown in chart 1. The average daily range for CL was 1.52 points over the last 20 days and 1.52 points over the last 10 days. The download file also provides for average weekly range and average monthly range, all of them calculated from intraday data.


          Sample Indicator 2 - Rolling Pivots

          Rolling Pivots are calculated from the N-day high, the N-day low and the last daily close. The formula is similar to the floor pivots, just the values entered for high, low and close are different, as multi-day highs and lows are used. The indicator allows to calculate rolling pivots from daily data (this causes synchronisation issues as you mentioned) and from intraday data. If you wish to use the settlement price for futures, this is only possible, if you use daily data and a data supplier (DTN/IQ or Kinetick) who supplies settlement data instead of the regular session close.

          The indicator can be found here (open source):

          The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies


          The indicator is shown in chart 2. The rolling pivots can be displayed for the full session (Globex pivots) or the regular session (floor pivots). You can also display Jackson Zones, Fibonacci or Camarilla pivots.


          Sample indicator 3 - Naked Gaps, Highs and Lows

          The indicator displays opening gaps (difference between settlement/close and regular open next day) which have not been closed, so called naked gaps. Those gaps often serve as support or resistance. The indicator also displays naked highs and lows that have not been taken out. The closing prices from the gaps can be taken from daily or intraday data. The regular highs and lows are taken from intraday data.

          The indicator is shown in chart 3. Gaps and hidden gaps (gaps that were only closed temporarily during the first day) can be calculated from the full session or regular session.
          Attached Files

          Comment


            #6
            Originally posted by Peter Cherry View Post
            Of course I know, I have read many similar posts. But I wrote 2 different questions above.

            Question 1 is about recalculation of 5-days into x-intraday bars etc.
            Question 2 is about finding 2 or 3 or n-days ago min/max.
            And general question is about working with dates and bar numbers.

            Regards
            Peter
            To get Highs and Lows of days from intraday timeframes, look up GetDayBar() in the NT Help.

            ref: http://www.ninjatrader.com/support/h.../getdaybar.htm

            Comment


              #7
              To Harry: Interesting indicators to study how they were built
              To koganam: Perfect, it seems to be the exact function I have been looking for

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by pechtri, 06-22-2023, 02:31 AM
              9 responses
              122 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by frankthearm, 04-18-2024, 09:08 AM
              16 responses
              66 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by habeebft, Today, 01:18 PM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by benmarkal, Today, 12:52 PM
              2 responses
              13 views
              0 likes
              Last Post benmarkal  
              Started by f.saeidi, Today, 01:38 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Working...
              X