Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 elirion, Today, 01:36 AM
          0 responses
          1 view
          0 likes
          Last Post elirion
          by elirion
           
          Started by gentlebenthebear, Today, 01:30 AM
          0 responses
          2 views
          0 likes
          Last Post gentlebenthebear  
          Started by samish18, Yesterday, 08:31 AM
          2 responses
          9 views
          0 likes
          Last Post elirion
          by elirion
           
          Started by Mestor, 03-10-2023, 01:50 AM
          16 responses
          389 views
          0 likes
          Last Post z.franck  
          Started by rtwave, 04-12-2024, 09:30 AM
          4 responses
          31 views
          0 likes
          Last Post rtwave
          by rtwave
           
          Working...
          X