Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

might be a dumb question but im stuck

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

    might be a dumb question but im stuck

    trying to do a simple MTF indicator.

    I understand how to add a new period to the script and have that compiling:
    Add (PeriodType.Ticks,Ticks);

    I am trying to add a comparison of CCI on that second period to a prior period (ie, if CCI is higher this bar vs. previous bar then do something).

    How do i reference say a 14 period CCI on that second period?

    I believe CCI(14)[1] refers to the 14 period cci of the second period type i added to the script....but then how to i compare that to a prior bar?

    CCI(14)[1][1]?

    thanks

    #2
    Hello,

    Thanks for the forum post glad to help.

    Multi-time frame works in NinjaTrader is based on whats known as BarsInProgress. The BarsInProgress is the bar that OnBarUpdate() is currently running on. OnBarUpdate() will get called for each Multi Time Frame you add in.

    You can access values of each BarsInProgress individually like so:

    //Primary Series 1 bar ago
    CCI(BarsArray[0], 15)[1];

    //Secondary Series 1 bar ago
    CCI(BarsArray[1], 15)[1];


    However you do not always need to use the BarsArray. As if you use the filter at the start of OnBarUpdate() if (BarsInProgress == 0) { this is primary series and you can use standard indicator call CCI(15)[1];}

    Please see this guide for more information.

    BrettNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    583 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    339 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    552 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X