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 pibrew, Today, 06:37 AM
          0 responses
          1 view
          0 likes
          Last Post pibrew
          by pibrew
           
          Started by rbeckmann05, Yesterday, 06:48 PM
          1 response
          12 views
          0 likes
          Last Post bltdavid  
          Started by llanqui, Today, 03:53 AM
          0 responses
          6 views
          0 likes
          Last Post llanqui
          by llanqui
           
          Started by burtoninlondon, Today, 12:38 AM
          0 responses
          11 views
          0 likes
          Last Post burtoninlondon  
          Started by AaronKoRn, Yesterday, 09:49 PM
          0 responses
          15 views
          0 likes
          Last Post AaronKoRn  
          Working...
          X