Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8 Issue: Bars.BarsType.DaysToLoad

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

    NT8 Issue: Bars.BarsType.DaysToLoad

    Trying to inquire from an indicator how many days of historic data are loaded to a chart.

    The following query returns the Default setting and what I need is the current actual setting.

    Print(" Bars.BarsType.DaysToLoad = " + Bars.BarsType.DaysToLoad);

    How do I get the current actual setting for the number of historic days of data loaded?
    RJay
    NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

    #2
    To clarify, you want to Loaded days, or the Requested days?

    You can use:

    Code:
    Print("ChartBars.Properties.DaysBack = " + ChartBars.Properties.DaysBack);
    However this may not be what you want. This is just the number of days the user configured, but does necessarily mean that was the exact number of days that was returned.

    If you want the total days returned/loaded, you'd need to calculate the time span in the bars series yourself. There is not a property that would provide this info to you.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by RJay View Post
      Trying to inquire from an indicator how many days of historic data are loaded to a chart. How do I get the current actual setting for the number of historic days of data loaded?
      I'm not sure if there is an easier way.. But a roundabout way would be

      Code:
       [COLOR=#0000ff]if[/COLOR]([COLOR=#080808]CurrentBar[/COLOR] == [COLOR=#ff8c00]0[/COLOR] && [COLOR=#080808]IsFirstTickOfBar[/COLOR])
       {
       [COLOR=#080808]     Print[/COLOR]([COLOR=#b22222]"Time of First Bar on Chart = "[/COLOR] + [COLOR=#080808]Time[/COLOR][[COLOR=#ff8c00]0[/COLOR]].[COLOR=#080808]ToString[/COLOR]());
       [COLOR=#080808]     Print[/COLOR]([COLOR=#b22222]"Time of Last Bar on Chart = "[/COLOR] + [COLOR=#080808]ChartControl[/COLOR].[COLOR=#080808]LastTimePainted[/COLOR].[COLOR=#080808]ToString[/COLOR]());
       [COLOR=#0000ff]     int[/COLOR] [COLOR=#080808]days[/COLOR] = ([COLOR=#080808]ChartControl[/COLOR].[COLOR=#080808]LastTimePainted[/COLOR] - [COLOR=#080808]Time[/COLOR][[COLOR=#ff8c00]0[/COLOR]]).[COLOR=#080808]Days[/COLOR]; 
       [COLOR=#080808]     Print[/COLOR]([COLOR=#b22222]"Total Days on Chart = "[/COLOR] + [COLOR=#080808]days[/COLOR]); 
       }

      -=Edge=-
      NinjaTrader Ecosystem Vendor - High Tech Trading Analysis

      Comment


        #4
        Originally posted by NinjaTrader_Matthew View Post
        To clarify, you want to Loaded days, or the Requested days?

        You can use:

        Code:
        Print("ChartBars.Properties.DaysBack = " + ChartBars.Properties.DaysBack);
        However this may not be what you want. This is just the number of days the user configured, but does necessarily mean that was the exact number of days that was returned.

        If you want the total days returned/loaded, you'd need to calculate the time span in the bars series yourself. There is not a property that would provide this info to you.
        Hi Matthew,

        That was what I needed.

        Thanks.
        RJay
        NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        672 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
        577 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