Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

When is the timeframe for a custom indicator is defined?

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

    When is the timeframe for a custom indicator is defined?

    Hi all,

    I'm developing a custom indicator to be used with the Market Analyzer.

    I want to compare things from different time frames. I want to compare things that are happening in the 34 minute time frame and in the 13 minute time frame.

    I see that when I add an indicator to a column I can assign it its time value so I can use a 13 minute time frame there. How would the 13 minute perform calculations on 34 minute data? It seems like a different indicator would be good but its not clear how to tell the indicator 'you are a 34 minute indicator'.

    thanks,

    john

    #2
    Hi John, you would need to code a custom NinjaScript study that would then be able to load the needed additional series in your indicator be used in the calcs as well - the framework in our NinjaScript to do so is documented here - http://www.ninjatrader.com/support/h...nstruments.htm
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Awesome, thank you! I'll read over.

      Comment


        #4
        I think I get it, can you confirm? For context I'm adding indicators as columns in the Market Analyzer

        BarsArray[0] holds the default timeframe for the indicator. In the case of a column in the Market Analyzer this period is set as the 'Value' property in the 'Data series' section of the properties of the indicator, correct?

        If that assumption is correct then setting the value in the property sheet to 5 minutes performs this action internally, correct?

        Add(PeriodType.Minute,5); // set BarsArray[0]

        So, to add a different time frame I can say in Initialize()

        Add(PeriodType.Minute,34); // add 34 minute data

        and then in OnBarUpdate() I can use the 34 minute data like this

        double e8 = EMA(BarsArray[1],8)[0]; // get 8 period EMA in 34 minute time frame

        1. Is this correct usage?
        2. Is this time frame (34 minute in this case) the same no matter what I choose as the default time frame, that setting the default time frame to a different value will not alter the meaning of other calls to 'Add'. My confusion had been wondering if any actions taken inside the indicator were somehow 'biased' by the default time frame, but I think now that is not the case, that there is an invisible call to Add() being done by the UI.

        do i have it?

        thanks,

        john

        Comment


          #5
          GM John, nice working through that - you mainly got it - the primary series is what you define in the chart or MA to use, it would be resting at BarsArray[0] or BarsInProgress == 0.

          The Add() call in the Initialize() adds a series then for internal calculations, it would not be visualized but

          a) the bars info could be used
          b) it's timing could be used as you can check when this added series calls the OnBarUpdate() method in your code (BarsInProgress check)

          In your EMA example you calculate this value based on the added timeframe series data, but without further filtering it would calculated on each primary series OnBarUpdate() call.

          Put another way, if you filter the primary series out of the OnBarUpdate() calls for the indicator it would be 'not biased' towards it.
          BertrandNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by pel11, Today, 06:44 PM
          0 responses
          2 views
          0 likes
          Last Post pel11
          by pel11
           
          Started by traderbot, Today, 06:40 PM
          0 responses
          4 views
          0 likes
          Last Post traderbot  
          Started by CCLQMT, Today, 05:31 PM
          0 responses
          8 views
          0 likes
          Last Post CCLQMT
          by CCLQMT
           
          Started by yodaler, Today, 03:17 PM
          2 responses
          12 views
          0 likes
          Last Post yodaler
          by yodaler
           
          Started by tatir, Today, 03:09 PM
          2 responses
          19 views
          0 likes
          Last Post tatir
          by tatir
           
          Working...
          X