Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddDataSeries(Data.BarsPeriodType.Tick, 1) vs Calculate = Calculate.OnEachTick

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

    AddDataSeries(Data.BarsPeriodType.Tick, 1) vs Calculate = Calculate.OnEachTick

    Hello,

    In my strategy, I have two data series, one is set up with Calculate = Calculate.OnBarClose; and the other set up with AddDataSeries(Data.BarsPeriodType.Tick, 1) .
    With that setup, my OnBarUpdate() will be called on every tick as well on every bar closed. Is my understanding correct? Thanks

    Billy

    #2
    Hello Billy,

    Thanks for your post.

    Calculate.OnBarClose is not a data series. The Calculate method determines how often OnBarUpdate() is called. If this is set to OnBarClose, the OnBarUpdate() method will process at the close of each bar.

    See this help guide page about Calculate: https://ninjatrader.com/support/help.../calculate.htm

    AddDataSeries() will add a secondary data series to your script. That added series can be used to calculate values or place trades based on that series.

    See this help guide about AddDataSeries(): https://ninjatrader.com/support/help...dataseries.htm

    For example, Close[0] could be used to get the close price of the primary series the script is running on. Closes[1][0] could be used to get the close price of the first added data series.

    Close: https://ninjatrader.com/support/help.../nt8/close.htm
    Closes: https://ninjatrader.com/support/help...nt8/closes.htm
    PriceSeries: https://ninjatrader.com/support/help...riceseries.htm

    Also, it is important to review this help guide page when working with Multi-Timeframe and Multi-Instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm

    Let me know if I 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


      #3
      Hello Brandon,

      Thank you for your reply. It is my understanding that with AddDataSeries(Data.BarsPeriodType.Tick, 1), the OnBarUpdate() will be called on every tick, in addition to the on Bar closed. Is that correct? Thanks.

      Billy

      Comment


        #4
        Hello Billy,

        Thanks for your note.

        Yes, AddDataSeries() will add the secondary Tick series to the script which will calculate at the close of each bar.

        Let me know if I 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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        64 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        139 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X