• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


Overlay Minute based indicator on bar chart trouble

  • Filter
  • Time
  • Show
Clear All
new posts

    What? I thought that OnUpdateBar is called when a bar closes. Then you check the BarsInProgress to see which bar closed, the 8 range or the 3 min. If we filter for just the 3 min bars, then we should get the same number of bars to work with as a 3min primary. Is that not correct?


      Hi TiggerTrader,

      Regardless of when a bar closes, plots are only synced with the primary data series.

      The plot will dictate the number of bars in the series and which bars are used in the calculation.

      Yes, OnBarUpdate is called when a bar closes. That is not was is causing the behavior.
      Chelsea B.NinjaTrader Customer Service


        Originally posted by NinjaTrader_ChelseaB View Post
        Hi TiggerTrader,

        Regardless of when a bar closes, plots are only synced with the primary data series.
        Yes, I agree. This has nothing to do with my issue, yet. Unless, what you are saying is that even tho I have a 3min bar close, and I have the correct 3min bar data, the plot associated with the 3min data is NOT plotted until the 8range bar closes, and then the data at that point is used regardless of the bar close state of the 3min bar.

        The plot will dictate the number of bars in the series and which bars are used in the calculation.
        I assume you are meaning the primary series is "the plot". So I interpret what you are saying, is that the primary series dictates when OnBarUpdate is called. I thought OnBarUpdate gets called whenever any bar in any series in the chart updates. I guess I am wrong.


          OK, I've been reading & re-reading the
          Multi-Time Frame & Instruments
          section of help.

          I'm having trouble with the plot idea. Specifically I am trying to create the 3min Stochastics in a new panel of an 8range chart.

          How does plot data differ from bar data from a timing point of view? Is it that I may get a call for a 3min bar and do my calculations, but the plot of my data does NOT occur until the next 8range bar closes? Or will it plot because the 3min bar closes?


            Hi TiggerTrader,

            A plot is the data series used for the points that will be displayed on the chart as a line.

            For example, when you place an SMA on a chart, the orange line is created from the plot dataseries.

            In an indicator this is set with Value.Set.

            A plot is added with Add(new Plot(Color.Blue, "myPlot"));

            All plots added (and yes you can add more than one) will be syncronized with the primary data series.

            If your chart is a 1 Minute chart, then the primary data series is a 1 minute data series. Each plot will hold 1 value per primary bar.

            If your primary bar is 8 range, and the secondary series is 3 minute, and there are 20 range breaks in that 3 minute period, then your plot will have 20 values that are the same. An average of this would be an average of the same value over and over 20 times.

            It is possible to synchronize a plot (or another dataseries to a secondary series).
            Below is a link to an example of how to do this.

            To answer your question, OnBarUpdate is called on both (all) data series. When either the 8 range or 3 minute bar closes OnBarUpdate will be called (with the proper BarsInProgress index). But again, whether OnBarUpdate is called is not the issue you are experiencing.

            Let me know if this does not clarify plots and the primary data series.
            Last edited by NinjaTrader_ChelseaB; 11-10-2014, 10:33 AM.
            Chelsea B.NinjaTrader Customer Service


              What you said makes some sense but doesn't apply to my problem.

              I am not overlaying the plot. It is in a different panel.

              I've attached my 3min Stochastics indicator. You can add it to an 8range chart as a new panel. Also, create a 3min chart with Stochastics to compare values. That is where the confusion ensues.

              As you can see, I print the OHLC of the 3min bar to the output window, and that works fine. I see the data every 3 minutes and it matches the candle on the 3min chart.

              So why wouldn't the data in the calculations be the same? I ONLY perform the Stochastics work when I get the new 3min bar.
              Attached Files


                Hi TiggerTrader,

                The plot is the visual data series but other than that it has nothing to do with your chart.

                I was trying to express what a plot is.

                However, overlay has nothing to do with what I am describing or anything visual on the chart. This is in code only. The panel has absolutely nothing to do with this issue.

                When you perform the calculation and save this to a plot, you are saving this to a 8 range plot not a 3 minute plot. The primary data series is 8 range then the plot is 8 range. Even if the calculations are made every 3 minutes and then saved to the plot (which is synchronized with the 8 range plot), the plot is still an 8 range plot.

                I brought up the SMA to help you understand that a plot will eventually be shown a chart, however, this is not what we are discussing. You are saving values that are calculated every 3 minutes to an 8 range plot series. There is a plot value for every primary bar not every secondary bar.
                Chelsea B.NinjaTrader Customer Service



                  OK, I'll work with that in mind. That explains the disconnect in my brain.



                  Latest Posts


                  Topics Statistics Last Post
                  Started by EnveousColnago, Yesterday, 05:43 PM
                  7 responses
                  Last Post Lancer
                  by Lancer
                  Started by PeterGolz, 01-17-2020, 10:42 AM
                  11 responses
                  Last Post reubenlasky  
                  Started by utilizator, Today, 11:36 AM
                  0 responses
                  Last Post utilizator  
                  Started by EnveousColnago, Today, 07:24 AM
                  1 response
                  Last Post NinjaTrader_ShawnB  
                  Started by tornadoatc, Today, 10:31 AM
                  0 responses
                  Last Post tornadoatc