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

Add(PeriodType.Range) question

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

    Add(PeriodType.Range) question

    Hello,
    I'm trying to create an indicator to use on an 8 range chart with data from a 30 range chart in NT7. I know it can be done as I've seen 3rd party indicators that will do this. I've tried to use Add(PeriodType.Range, 30). Doing this does change the appearance of the indicator on an 8 range chart, but nothing like what it looks like on an actual 30 range chart. Can someone give me an idea of how to do this?
    I fiddled around with it in NT8 with AddDataSeries(BarsPeriodType.Range,30); and the results were similar. The indicator looks more like the period was simply increased. Any help is greatly appreciated.

    #2
    Hello CaptainAmericaXX,

    Thanks for your post.

    Plotting data based on a higher time frame generally would result in a stair step type effect in the lower time frame. This is because the data on the higher time frame does not change as fast as it does on the lower time time frame and this is even more pronounced in non time based bars (in this case range bars) because the number of bars can vary. However, despite the stair step, the indicator value should match when looking at the same time from the same indicator plotted on the lower to the same indicator plotted on the higher and considering which calculate mode is used.

    To illustrate please see the attached plot display and code example. Two 10 period SMAs are plotted, one from the chart bars and one from an added 30 range data series. On each bar update of the primary series, both plots are updated with the with their value at the time of the plot.
    Attached Files
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Paul,
      Thank you for providing that code example it was very helpful. I'm still working primarily in NT 7 and I'm still having an issue adding a different PeriodType to my chart.
      protected override void Initialize()
      {
      Add(PeriodType.Range, 2);
      {
      This is all I've done to the indicator and it works ok most of the time, but occasionally it won't plot and I get the error "You are accessing an index with a value that is invalid since its out of range". I studied the BarsInProgress info, but I'm not comprehending how to make it work. Could you give me an example of how to add this properly?
      Thanks

      Comment


        #4
        Hello CaptainAmericaXX,

        Thanks for your reply.

        I understand you are looking for an NT7 example and have added a 2 range data series to the indicator. Do you have any plots in the indicator? What are you doing or wanting to do with the 2 range data? What is the chart's data series?
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello Paul,
          I downloaded the RMI indicator.
          I like to see a 2 range when I'm working with a 4 range. I have a variety of instruments that I use the indicator on. Mainly I just want to understand how to use indicators with range bars different than the primary bar on the chart. Thank you for helping me with this.
          Attached Files

          Comment


            #6
            Hello CaptainAmericaXX,

            Thanks for your reply.

            I've modified the example you provided to show what changes need to be made to draw the RMI 2 range on a different time frame chart. In addition to isolating by using the BarsInProgress and CurrentBars[], the added dataseries of avgUp and avgDown need to be synchronized to the added 2 range data series so that these dataseries have the same number of slots/bars that match the 2range series, otherwise the calculation values would be incorrect. To read more on synchronizing please see an example here: http://ninjatrader.com/support/forum...ead.php?t=3572

            In the chart example provided below, the left chart shows a 2 range data series with the typical RMI indicator. The right chart shows 4 range data, typical 4 range RMI then the added modified 2 range RMI2rangeb.

            Please help us keep the forums organized by posting NT7 in the NT7 forum.
            Attached Files
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by maybeimnotrader, Yesterday, 05:46 PM
            5 responses
            24 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by NRITV, Today, 01:15 PM
            0 responses
            2 views
            0 likes
            Last Post NRITV
            by NRITV
             
            Started by quantismo, Yesterday, 05:13 PM
            2 responses
            16 views
            0 likes
            Last Post quantismo  
            Started by frankthearm, Today, 09:08 AM
            6 responses
            26 views
            0 likes
            Last Post frankthearm  
            Started by adeelshahzad, Today, 03:54 AM
            5 responses
            33 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X