Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pass IDataSeries to Custom Indicator

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

    Pass IDataSeries to Custom Indicator

    I created a simple indicator to return the Average Daily Range of a futures contract over a period of days. I need to pass a different timeframe to it from the calling strategy.

    The chart I am viewing is running a range bar chart and I need to calculate the previous 7 day Average Daily Range.

    Ini Initialize I added:
    Add(PeriodType.Minute, 1440); // Use for ePrvADR calculation 1440m = 1 Day

    For Debug purposes in OnBarUpdate I have

    Print("PrvADR: " + ePrvADR(Bars[1],2) );

    And the Bars[1] is not the right way to pass in the IDataSeries.

    How do I pass the 1440m bars data into this function?

    Thank you

    #2
    Hello,
    What value are you trying to get from the secondary data series? Are you wanting the Close, the low, ATR value?
    I look forward to your reply.
    Cody B.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      I am calculating an Average Daily Range, so I need to Pass the Highs and Lows of the last x candles.

      ePrvADR(series,period)

      So if period was 5 I would need the last 5 Highs and Lows to calculate the range of each full day RTH+ETH. But I just want the return value to be the ADR for that period

      Comment


        #4
        Hello,
        You can get the range of a bar by using the Range Method. What may work for you is creating a data series and setting the data series equal to Range()[0] and then pass that in as your series for your method. For more information on the Range method please see the followign link: http://ninjatrader.com/support/helpGuides/nt7/range.htm
        Cody B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by EricC64 View Post
          Print("PrvADR: " + ePrvADR(Bars[1],2) );

          And the Bars[1] is not the right way to pass in the IDataSeries.

          How do I pass the 1440m bars data into this function?
          Use BarsArray[1] not Bars[1].

          Studying the attachment at this link might help.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          68 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          38 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          63 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          62 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          53 views
          0 likes
          Last Post CarlTrading  
          Working...
          X