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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    63 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    35 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    54 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    61 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    48 views
    0 likes
    Last Post CarlTrading  
    Working...
    X