Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Higher Time Period Updating each tick

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

    #16
    Hi tradethebonds,

    That was my mistake.

    We do want this to plot on BarsInProgress == 2. The code now returns if it is BIP 2.

    Try:

    if (BarsInProgress != 2)
    return;

    This would prevent all other BIPs from executing except for 2.

    I apologize for giving you the wrong info there.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Thank you, appreciate your time!

      Please see 34 second video.

      World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


      Best,

      TX

      Comment


        #18
        Hi tradethebonds,

        Let me do some more testing with this to get you an answer.

        I'll be back with you shortly.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #19
          Ok, I appreciate your help in case you cannot get to work.

          Comment


            #20
            Hello tradethebonds,

            Thanks for your patience.

            So the issue is this: historical data is always process with CalculateOnBarClose as true. This means that you cannot set the plot intrabar while BarsInProgress 1 (4000 tick series) is processing (in historical). To get around this you can add a 1 tick granularity to the script so that it processes every tick. The issue with this is that the Typical price of BarsInProgress 1 will not change until a new bar is formed (4000 ticks at a time) because COBC is true (in historical).

            Another issue is that plots are synced with the primary data series. This means even if you could get intrabar data for the 4000 tick series, the plot itself will have the same amount of data points as the 800 tick series. Meaning that there can only be one point on the plot per bar on the chart. This would still cause jagged lines.

            Because of these limitations there really is not a way to accomplish your goal.

            Below is the code you would want for at least having this plot in real time.

            Code:
            protected override void Initialize()
            {
            Add(PeriodType.Tick, 4000);
            Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
            Overlay				= true;
            CalculateOnBarClose = false;
            }
            
            protected override void OnBarUpdate()
            {
            if (BarsInProgress != 0 || CurrentBars[1] < 1)
            return;
            
            Plot0.Set(Typicals[1][0]);
            }
            Chelsea B.NinjaTrader Customer Service

            Comment


              #21
              Thank you, appreciate your time and effort.

              Best,

              TX

              Comment


                #22
                I think I have the solution to this...

                If I take the 5- bar high, the 5-bar low and the close of the last 800 tick bar, then divide by three and I will have the typicals of a rolling window of 4000 ticks.

                How can I test for the recent 5 bar high and 5 bar low please?

                Best,

                TX

                Comment


                  #23
                  Hi tradethebonds,

                  You can get the highest or lowest bar in the last 5 bars using the MAX and MIN indicators.

                  For example to get the highest bar in 5 bars for the primary data series:

                  double highestIn5 = MAX(Highs[0], 5)[0];

                  or for the low:

                  double lowestIn5 = MIN(Lows[0], 5)[0];

                  Please let me know if this does not resolve your inquiry.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #24
                    Thank you very much, have a great weekend!

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    597 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    343 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    103 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    556 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    555 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X