Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-Time Frame script

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

    Multi-Time Frame script

    hi

    i develop indicator in in NT8 b6

    and have problem to work with multiple time frame
    it looks that secondary Series is not generated

    my code looks like this

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "Test";
    // bla bla
    }
    else if (State == State.Configure)
    {

    AddDataSeries(BarsPeriodType.Minute, 2);
    }
    }


    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1)
    {
    chartBars1 = ChartControl.BarsArray[1];

    }

    }

    while in indicator level i defined :
    ChartBars chartBars1;

    i get message : Error on calling 'OnBarUpdate' method on bar 2: You are accessing an index with a value that is invalid since it is out-of-range. as a result of command
    chartBars1 = ChartControl.BarsArray[1];
    in BarsArray was only one series the primary bars of the chart


    what am i missing ?

    #2
    Hello Doron,

    Thank you for your post.

    A ChartBars object will ONLY exist should the hosting NinjaScript type be loaded through a Chart. For example, a Strategy would have access to a ChartBars property when running on a Chart, but would NOT when loaded through the Strategies Grid or Strategy analyzer.
    Taken from ChartBars: http://ninjatrader.com/support/helpG.../chartbars.htm

    So AddDataSeries() will not add a bar series through the chart (UI), which means ChartBars would not have any detail on the secondary series.

    What are you looking to achieve with the ChartBars from a secondary series?

    Comment


      #3
      hi

      i need "access" from my indicator to Time and volume high and low of each bar of the secondary series
      how that can be done

      Comment


        #4
        hi

        just found that :

        double SecondaryClose = Closes[1][0];

        DateTime SecondaryTime = Times[1][0];

        probably works

        Closes instead of Close , Times instead of Time

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        670 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        379 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        582 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X