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 Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          835 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,291 views
          1 like
          Last Post jgualdronc  
          Started by Touch-Ups, Today, 10:36 AM
          0 responses
          10 views
          0 likes
          Last Post Touch-Ups  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          11 responses
          62 views
          0 likes
          Last Post halgo_boulder  
          Started by Option Whisperer, Today, 09:55 AM
          0 responses
          9 views
          0 likes
          Last Post Option Whisperer  
          Working...
          X