Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsSinceSession

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

    BarsSinceSession

    Does Bars.BarsSinceSession work in indicators?

    I created a new indicator with the wizard, add one variable and this line of code, nothing else, and it won't compile:

    numberBars = Bars.BarsSinceSession;

    #2
    Hello coolmoss,
    Yes, Bars.BarsSinceSession works in indicators too.

    Please refer here to know more about it
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hi Joydeep,

      Can you suggest any reason why the indicator won't compile?

      This is totality of code:

      protected override void OnBarUpdate()
      {
      // Use this method for calculating your indicator values. Assign a value to each
      // plot below by replacing 'Close[0]' with your own formula.
      numberBars = Bars.BarsSinceSession;
      Bars.Set(4);
      }

      One other thing of interest: I start typing "Bars", then hit the "." and the editor pops up with the properties list for the method. On this pop up, BarsSinceSession does not appear.

      Comment


        #4
        Hello coolmoss,
        Have you named a custom plot/data series as Bars. If so then please change it and see if you can compile it or not.

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Thanks! That was it. I inadvertently named the data series "bars". I have no idea what I was thinking.

          Comment


            #6
            Hello coolmoss,
            Glad to know everything is running fine at your end.

            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by sjsj2732, Yesterday, 04:31 AM
            0 responses
            30 views
            0 likes
            Last Post sjsj2732  
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            286 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            282 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            132 views
            1 like
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            90 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Working...
            X