Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Acces another TimeFrame (1minute) without opening it

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

    Acces another TimeFrame (1minute) without opening it

    Hi again!

    One simple question:

    Is it possible to acces the data from TimeFrame from current Instrument, without opening it in the same chart?

    My idea:
    I'm in a chart, i.e. at 60 minute TF.
    With a DrawingTool I select 2 points of this chart.
    Having selected them, I can know their Time
    With this Time, can I know wich bar possition it is in another TimeFrame (in this case I want it in 1 Minute)?

    As I'm with a DrawingTool I don't want to open a 1 minute chart on this window.....

    Thx!



    #2
    Hello arston,

    Thanks for your post.

    From a DrawingTool, the attached data series can be found using GetAttachedToChartBars(). This ChartBars could be used with the ChartControl.GetXByValue() method to get an X coordinate and then you can use ChartBars.GetBarIdxByX() with another ChartBars to get the bar index on that other data series.

    To find another ChartBars on the chart, you will want to loop through the ChartObjects collection and find your ChartBars. For example:

    Code:
    Chart chartWindow = Window.GetWindow(chartControl.Parent) as Chart;
    foreach (NinjaTrader.Gui.Chart.ChartPanel panel in chartWindow.ActiveChartControl.ChartPanels)
    {
        foreach (Gui.NinjaScript.IChartObject thisObject in panel.ChartObjects)
        {
            if (thisObject is ChartBars)
            {
                ChartBars myFoundChartBars = thisObject as ChartBars;
                if (myFoundChartBars.Bars.BarsPeriod.BarsPeriodType == BarsPeriodType.Minute 
                    && myFoundChartBars.Bars.BarsPeriod.Value == 1)
                    Print("1 Minute Data Series found");
            }
        }
    }
    ChartBars.GetBarIdxByX() - https://ninjatrader.com/support/help...tbaridxbyx.htm

    ChartControl.GetXByBarIndex() - https://ninjatrader.com/support/help...bybarindex.htm

    GetAttachedToChartBars() - https://ninjatrader.com/support/help...ochartbars.htm

    ChartBars - https://ninjatrader.com/support/help.../chartbars.htm

    Please let us know if we can be of further assistance.

    Comment


      #3
      Hi Jim,

      Thanks,

      But the question is: on my chart (or window), do I need to have the 1 minute TF bar chart?, or can I only have one chart (i.e. 60 minute) and from this only bar chart on the window, I can access the 1 minute bar data series (Information)?

      Because I don't want to have the 1 minute series open......

      Thx,

      Comment


        #4
        Hello arston,

        Thanks for clarifying.

        The bars data will have to exist somewhere. You could make a BarsRequest from the Drawing Tool to make the data available if it is not already, or you could find it on the chart like in post #2.

        Keep in mind, BarsRequests are asynchronous. After making a BarsRequest, your script will continue while the bars being requested will be processed on another thread. Further notes and example code for a BarsRequest is included in the documentation page below.

        BarsRequest - https://ninjatrader.com/support/help...arsrequest.htm

        Please let us know if you have any additional questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X