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 NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X