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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        79 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        63 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        63 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        54 views
        0 likes
        Last Post CarlTrading  
        Working...
        X