Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

MTF OnBarUpdate calls order

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

    MTF OnBarUpdate calls order

    Hello.

    Say, I have MTF script. Indicator.
    Say, primary series 1 Min, and secondary 10 Min.

    Say 10:00 o'clock now.

    For witch series OnBarUpdate() will run first: for primary 1 Min, or for secondary 10 Min?

    Is there exact run order - or this order is random?
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Oh, I found answer:

    During historical data processing, NinjaTrader updates the two series strictly according to their timestamps, calling the primary bar series of the corresponding timestamps first, and then calling the secondary series.

    But, also:

    A multi-series indicator will hold the same number of data points for plots as the primary series. Setting values to plots should be done in the primary series in OnBarUpdate().

    And, if set plots values from primary series only, when primary and secondary bars have same timestamps - indicator lagging in 1 bar.

    Simplest way to check it - to choose secondary timeframe same to primary.
    Last edited by fx.practic; 11-19-2017, 02:07 PM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    Comment


      #3
      Hello fx.practic,

      As long as the series are using the same instrument, it will be guaranteed that both have the same amount of historical data available.

      In this situation the 1 minute will process 10 times, then the 10 minute series will process once just after the 10th update for the primary series.

      If your primary series is a 1 minute series and the secondary series is a 10 minute series, any plots will be synchronized with the 1 minute series.

      If you were to set the plot on the secondary series, every 10 minutes, no plot will appear on the chart because a plot needs to be set on concurrent bars to render. (You would only have a value every 10 1 minute bars and no plot will appears due to bars having no values)

      If you set the plot only when the bar closes, the plot will always be 1 bar behind (as the plot is only be set when a bar has closed. The current building bar will not be closed).

      If you set the plot before the bar closes (with Calculate set to OnEachTick or OnPriceChange in real-time or with TickReplay enabled historically) then the plot will be set on the currently building bar (because it is set before the bar is closed).
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Is that mean, that in NT8 one only way to plot indicators from big timeframe without 1 bar lagging is to use CalculateOnBarClose ?
        fx.practic
        NinjaTrader Ecosystem Vendor - fx.practic

        Comment


          #5
          Hello fx.practic,

          Yes, if you are using input series for an indicator, adding a secondary series won't cause that indicator to update.

          The Calculate is the only thing that can cause that indicator to update. When set to .OnEachTick it will cause the indicator to update for each tick. When set to .OnPriceChange the indicator will update on each price change.

          Adding a additional series of 1 tick to a script, does not cause a indicator that uses the input series of the primary series to update for each tick. It will only update when the primary updates.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          11 responses
          1,422 views
          0 likes
          Last Post jculp
          by jculp
           
          Started by RubenCazorla, Today, 09:07 AM
          0 responses
          4 views
          0 likes
          Last Post RubenCazorla  
          Started by BarzTrading, Today, 07:25 AM
          2 responses
          29 views
          1 like
          Last Post BarzTrading  
          Started by devatechnologies, 04-14-2024, 02:58 PM
          3 responses
          21 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by tkaboris, Today, 08:01 AM
          0 responses
          6 views
          0 likes
          Last Post tkaboris  
          Working...
          X