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 rajendrasubedi2023, Today, 09:50 AM
        0 responses
        6 views
        0 likes
        Last Post rajendrasubedi2023  
        Started by ender_wiggum, Today, 09:50 AM
        0 responses
        2 views
        0 likes
        Last Post ender_wiggum  
        Started by bmartz, Today, 09:30 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by geddyisodin, Today, 05:20 AM
        3 responses
        23 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by lorem, Today, 09:18 AM
        1 response
        5 views
        0 likes
        Last Post lorem
        by lorem
         
        Working...
        X