Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi TimeFrame Indicator Help

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

    Multi TimeFrame Indicator Help

    I am currently developing multi timeframe indicators. For example, below I developed a simple adx mult timeframe indicator that I can use with range bar types. What I would like to do is adjust this program to be able to receive any type (i.e. minutes, seconds, ticks, etc...) instead of only range. Can anyone give me some guidance on how I would approach this?

    protected override void Initialize()
    {
    Add(PeriodType.Range, range);
    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "ADXComp Line"));
    Overlay = false;
    CalculateOnBarClose = false;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired)
    return;
    double ADXComp = (ADX(BarsArray[1],adxperiod)[0]);
    ADXCompLine.Set(ADXComp);
    }

    #2
    Hi traderjem,

    Thanks for the post and welcome to the NinjaTrader forums! For timing reasons, we support only hard coding additional series. This is controlled with the Add() statements, possible values are available here:
    http://www.ninjatrader.com/support/h...s/nt7/add3.htm
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hey Ryan

      So are you saying I should ADD each potential period type I want and then send a flag from my properties to tell it which type to use (like in a case statement)?

      Comment


        #4
        That could be one way to do it. There is no supported technique for conditionally adding series to your script but you could add all potential series you need. Then work a case statement into OnBarUpdate() for accessing.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_RyanM View Post
          That could be one way to do it. There is no supported technique for conditionally adding series to your script but you could add all potential series you need. Then work a case statement into OnBarUpdate() for accessing.
          That reminds me -- for a long time now I have wanted the ability to use Add() in OnStartUp(). Such an action, of course, would mean that the properties of whatever is added isn't accessible from the indicator properties. And it would also probably mean that something in OnTermination() would be needed to destroy whatever got added. But this would be a nice way to handle the need to add things conditionally based on the input parameters.

          It strikes me as wasteful of both memory and CPU to add every possible time frame and then use just one of them.

          -A

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wftrrdt, Today, 05:01 AM
          0 responses
          2 views
          0 likes
          Last Post wftrrdt
          by wftrrdt
           
          Started by wellbeingcbd, Today, 04:41 AM
          0 responses
          1 view
          0 likes
          Last Post wellbeingcbd  
          Started by piydasuknu, Today, 03:45 AM
          0 responses
          3 views
          0 likes
          Last Post piydasuknu  
          Started by ajdfkgjiojjhfihjg, Today, 03:20 AM
          0 responses
          3 views
          0 likes
          Last Post ajdfkgjiojjhfihjg  
          Started by keravitahere, Today, 01:56 AM
          0 responses
          2 views
          0 likes
          Last Post keravitahere  
          Working...
          X