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 judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X