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

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.

      Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


      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 gravdigaz6, Yesterday, 11:40 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by MarianApalaghiei, Yesterday, 10:49 PM
                    3 responses
                    10 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by XXtrader, Yesterday, 11:30 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post XXtrader  
                    Started by love2code2trade, 04-17-2024, 01:45 PM
                    4 responses
                    28 views
                    0 likes
                    Last Post love2code2trade  
                    Started by funk10101, Yesterday, 09:43 PM
                    0 responses
                    9 views
                    0 likes
                    Last Post funk10101  
                    Working...
                    X