Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IsFirstTickOfBar and RemoveLastBar()

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

    IsFirstTickOfBar and RemoveLastBar()

    I am developing a multi-time frame strategy that will have multiple Bars objects of the same instrument. I will have Calculate set to OnEachTick or OnPriceChange, however, I want some of the calls to OnBarUpdate to be on bar closes and not on each tick. The bars type that I am using does contain RemoveLastBar().

    On the IsFirstTickOfBar page it states the following:
    • Note: If a bar type is set up to remove the last bar on a chart, IsFirstTickOfBar will automatically be set to True.
    If I am understanding that correctly, I cannot use IsFirstTickOfBar. Therefore, is there another solution?

    Thanks

    #2
    Hello Epistemophilic,

    Thank you for your post.

    The issue with using IsFirstTickOfBar in the case of Bars Types that re-draw their open such as the Renko bars is that these Bars Types use RemoveLastBar() to allow for re-drawing and this function in turn calls OnBarUpdate() a second time, and depending on the bar type, sometimes even more.

    I'm attaching an example script where you can see that at work - you can run this on any chart as it pulls in a 2 renko series of whatever instrument you apply it to and makes prints in the NinjaScript Output window based on that. You'll note that while at times IsFirstTickOfBar returns as not being true - that it returns as true multiple times for each bar even when we add the series as a secondary series. This is due to the redrawing that occurs and makes IsFirstTickOfBar not useful in a script using a bar type that uses RemoveLastBar().

    I am unaware of any workaround for this. However, I have added a vote for you to a current feature request to not set IsFirstTickOfBar to true when RemoveLastBar is called. This request is being tracked under the number SFT-3298.

    As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

    Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

    Please let us know if we may be of further assistance to you.
    Attached Files

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    93 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    138 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    123 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    73 views
    0 likes
    Last Post PaulMohn  
    Working...
    X