Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Detecting same BarsPeriodType and Value

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

    Detecting same BarsPeriodType and Value

    I was planing to AddDataSeries(BarsPeriodType.Tick, 500);

    However, I noticed that, if my chart is already BarsPeriodType == Tick and value == 500, it still run the AddDataSeries.

    Is that anyway to detect it and thus not adding the AddDataSeries(BarsPeriodType.Tick, 500); when my chart is already same BarsPeriodType and value same.

    #2
    Hello cincai,

    Thank you for writing in.

    In most cases, we could retrieve information on the primary data series from State.Configure using BarsPeriod, but this is not fully supported. (Optimizations are one place where accessing data from State.Configure would not be able to load information on primary data series)

    That being said, you could use BarsPeriod.BarsPeriodType and BarsPeriod.Value to get the BarsPeriod type and value within your script.

    Also, something you could do is write the logic in your script to ignore BarsInProgress 0 within the OnBarUpdate() method. To do so, the code would look something like this.

    if (BarsInProgress == 0)
    return;

    See the help guide documentation below for more information.
    BarsPeriod - https://ninjatrader.com/support/help...barsperiod.htm
    BarsInProgress - https://ninjatrader.com/support/help...inprogress.htm

    Let us know if we may assist further
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    64 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    94 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    50 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    108 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    63 views
    0 likes
    Last Post PaulMohn  
    Working...
    X