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 argusthome, Yesterday, 10:06 AM
        0 responses
        20 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        18 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        14 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        9 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        40 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X