Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CurrentBar in multi-timeframe

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

    CurrentBar in multi-timeframe

    Hi All,
    I have a 2 quick questions. If the base time period for my chart feed is 1min, does the CurrentBar statement below refer to bar 60 in the 5min timeframe or bar 60 in the 1min timeframe?
    Second question: Does the BarsRequired statement mean I must have a minimum of 200 1min bars as that is my base time period for my chart data feed?


    Code:
            protected override void Initialize()
            {
                		CalculateOnBarClose = true;
    			ExitOnClose = false;
    			BarsRequired = 200;
    			
    			Add(PeriodType.Minute, 1);  // BarsInProgress index = 1
    			Add(PeriodType.Minute, 5);  // BarsInProgress index = 2
    			
            }
    
    
            protected override void OnBarUpdate()
            {
    
    			if (BarsInProgress==2 && CurrentBar>60)
    			{

    #2
    Hello itsnotme,

    Thank you for your post.


    1)
    CurrentBar is referring to the current BarsInProgress, in this case the 5 min bars

    Since you are using a Multi-Time Frame script, it is suggested that you use CurrentBars


    Using Bars Objects as Input to Indicator Methods


    2)
    BarsRequired - The number of bars on a chart required before the indicator plots or a strategy is processed. This is NOT the same as a minimum number of bars required to calculate the indicator values.
    http://www.ninjatrader.com/support/h...srequired2.htm
    CameronNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, Yesterday, 10:06 AM
    0 responses
    22 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    19 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    14 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    10 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    41 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X