• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    JimNinjaTrader Customer Service

    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.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ryanmercado, Today, 10:04 AM
        0 responses
        2 views
        0 likes
        Last Post ryanmercado  
        Started by uiwislth, Yesterday, 11:25 PM
        0 responses
        5 views
        0 likes
        Last Post uiwislth  
        Started by Steve L, Yesterday, 10:04 PM
        0 responses
        3 views
        0 likes
        Last Post Steve L
        by Steve L
         
        Started by marianfed, Yesterday, 09:47 PM
        0 responses
        5 views
        0 likes
        Last Post marianfed  
        Started by hir04068, Yesterday, 09:29 PM
        0 responses
        7 views
        0 likes
        Last Post hir04068  
        Working...
        X