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 carnitron, Today, 08:42 PM
          0 responses
          6 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Today, 07:51 PM
          0 responses
          8 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,974 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          9 views
          0 likes
          Last Post rbeckmann05  
          Started by rhyminkevin, Today, 04:58 PM
          4 responses
          58 views
          0 likes
          Last Post dp8282
          by dp8282
           
          Working...
          X