Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

FirstTickofBar for Volume

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

    FirstTickofBar for Volume

    Hello NinjaTrader!

    For the life of me I cannot firgure out how to get the first tick of bar for volume chart(s). I've read the tip in the NinjaTrader 8 documentation:
    Tip:

    In NinjaTrader's event driven framework, bar closures are signaled by the tick that opens the next bar. The price of the last tick of a bar can be referenced by checking Close[1] on IsFirstTickOfBar. For volume and tick based bars, Bars.TickCount and Volume[0] can be referenced to see if the number of ticks / volume meet the criteria to build a new bar.


    I need help issuing the correct command to get the first tick of Volume Bar. Any help would be appreciated.

    Thank you​

    #2
    Hello geekodude,

    Rather than using the items from that description you could do the same concept as the BuySellVolume indicator which uses the CurrentBar index to know when a new bar is created. The first tick which is received that creates a new bar will increment the CurrentBar index. A simple condition can be used to check if the index of the CurrentBar is greater than a stored variable. The script would need to be run OnEachTick in realtime.


    Code:
    private int activeBar = 0;
    protected override void OnBarUpdate()
    {​
       if (CurrentBar != activeBar)
       {
          //your first tick of bar logic here
          activeBar = CurrentBar;
       }​
    }

    Comment


      #3
      Hello Jesse:

      This works Thank you! :-)

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      43 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      30 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Working...
      X