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

NinjaTrader Close[1] on Renko Chart

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

    NinjaTrader Close[1] on Renko Chart

    Hi,
    Close[0] > Close[1]
    Is not working when I have my chart on the renko chart.
    I can't call any lagged values for the previous renko bars on my time series, doing so causes my indicator to stop working.
    How could I fix or work around this?

    Kind regards,





    #2
    Hello OllieFeraher,

    Welcome to the NinjaTrader forums!

    What do you mean by not working?

    Do you mean the close of the most recently updated bar is equal to or less than the close of the previous bar?

    Can you provide output from prints showing the issue?
    https://ninjatrader.com/support/foru...121#post791121

    Print the time of the bar, print all values in the condition along with labels for each value and comparison operator.

    Save the output to a text file, and include this with your reply.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      As in

      When I add this to my script it works.
      double oldClose = Close[0];

      When I change this to
      double oldClose = Close[1];
      It does not work.

      I just wish to reference the previous renko bars.

      The code compiles fine in all cases but my bands, similar to bollinger bands fail to show up in the second.
      Last edited by OllieFeraher; 01-04-2023, 02:49 PM.

      Comment


        #4
        protected override void OnBarUpdate()
        {
        //Add your custom indicator logic here.

        if(Close[0] > Close[1] && Close[1] > Close[2] && Close[2] > Close[3]){
        Draw.Dot(this, "4UP-" + CurrentBar, true, 0, Close[0] + 40, Brushes.Yellow);
        }

        }​

        So this works find on CandleSticks and HeikenAshi the dots show up easily, but they do not show up on Renko.

        Comment


          #5
          Hello OllieFeraher,

          That would mean the condition is not evaluating as true.

          Print the time of the bar and all of the values with labels to find out why.

          Also, are you checking the Drawing Objects window to confirm there are no drawing objects drawn?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6



            Rewritten so one condition must evaluate to true and one false so I can't see it being that.

            Works on candlesticks still does not work when chart is in Renko.

            protected override void OnBarUpdate()
            {
            //Add your custom indicator logic here.

            if(Close[0] > Close[1]){
            Draw.Dot(this, "4UP-" + CurrentBar, true, 0, Close[0] + 40, Brushes.Yellow);
            }

            if(Close[0] <= Close[1]){
            Draw.Dot(this, "4UP-" + CurrentBar, true, 0, Close[0] - 40, Brushes.Red);
            }

            }​


            plus any Close[1] causes my indicator to not work.






            Comment


              #7
              This is what the print is giving me in the output.

              Print("Close[0]" + Close[0]);
              Print("Close[1]" + Close[1]);​


              Close[0]33490
              Indicator 'RenkoTest': Error on calling 'OnBarUpdate' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

              Comment


                #8
                Issue fixed.
                Cause, a silly assumption.
                I did not think to make sure my currentbar was high enough and assumed it was an issue with renko itself because this did not happen with regular candlesticks

                Thank you for Chelsea


                Comment


                  #9
                  Hello OllieFeraher,

                  Are there errors appearing on the Log tab of the Control Center?
                  if that is the only code in OnBarUpdate(), using Close[1] would cause an error as there is no check there are at least 2 bars.
                  Hello, I want to create an indicator that show data in a chart but calculate in other charttime different to the time of the chart where is showed. For example:


                  Use Prints to understand.


                  Open the Drawing Objects window after enabling the script, take a screenshot, provide the screenshot.

                  Video to demonstrate.

                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Segwin, 05-07-2018, 02:15 PM
                  10 responses
                  1,769 views
                  0 likes
                  Last Post Leafcutter  
                  Started by Rapine Heihei, 04-23-2024, 07:51 PM
                  2 responses
                  30 views
                  0 likes
                  Last Post Max238
                  by Max238
                   
                  Started by Shansen, 08-30-2019, 10:18 PM
                  24 responses
                  943 views
                  0 likes
                  Last Post spwizard  
                  Started by Max238, Today, 01:28 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post Max238
                  by Max238
                   
                  Started by rocketman7, Today, 01:00 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post rocketman7  
                  Working...
                  X