Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Point counter indicator on each bar

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

    Point counter indicator on each bar

    ---------kfkjkjhkhklgh
    Last edited by tradingnasdaqprueba; 10-12-2023, 02:00 AM.

    #2
    This Bar Counter will help with some modification for '_________ ' ,see link , https://ninjatraderecosystem.com/use...d/bar-counter/

    Comment


      #3
      Hello tradingnasdaqprueba,

      Thank you for your post.

      You can get the High and Low values for the current bar using the High and Low series.

      High - https://ninjatrader.com/support/helpGuides/nt8/high.htm

      Low - https://ninjatrader.com/support/helpGuides/nt8/low.htm



      You could then calculate the range and divide it by the TickSize by accessing the value for each bar.

      double Points = (High[0] - Low[0]) / TickSize


      TickSize - https://ninjatrader.com/support/help...8/ticksize.htm

      You can draw text below the bar using Draw.Text().

      Draw.Text() Help Guide page - https://ninjatrader.com/support/help.../draw_text.htm

      Draw.Text(NinjaScriptBase owner, string tag, string text, int barsAgo, double y)


      If you want to draw on the building bar, make sure you are using the appropriate Calculate setting. OnBarClose means OnBarUpdate will only update or draw the text when the bar has closed.

      Calculate Help Guide page - https://ninjatrader.com/support/help.../calculate.htm

      Please let me know if you have any other questions.

      Comment


        #4
        Perfect! Thank you Gaby it works perfectly
        Last edited by tradingnasdaqprueba; 10-12-2023, 02:00 AM.

        Comment


          #5
          Hello tradingnasdaqprueba,

          MaximumBarsLookBack only applies to a custom Series<T> and loads less data of the secondary series that Infinite.


          You can use logic to process on the last 20 historical bars and then in realtime.

          if (State == State.Historical && CurrentBar < Count - 20)
          return;
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hello Chelsea,

            Could you please tell me where should I include this state? Thanks!

            Last edited by tradingnasdaqprueba; 10-12-2023, 01:56 AM.

            Comment


              #7
              Hello tradingnasdaqprueba,

              This would go at the top of OnBarUpdate() where you are trying to prevent the logic from being evaluated before the last 20 historical bars.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Hello Chelsea,

                IThanks a lot again for the help!


                Last edited by tradingnasdaqprueba; 10-12-2023, 02:01 AM.

                Comment


                  #9
                  Hello tradingnasdaqprueba,



                  Your statement is missing the 'return' after the 'if' statement.



                  if (State == State.Historical && CurrentBar < Count - 20)

                  return;



                  Please let us know if we can assist further.

                  Comment


                    #10
                    Hello Gaby,

                    Thank you so much! now works perfectly.

                    Last edited by tradingnasdaqprueba; 10-12-2023, 02:01 AM.

                    Comment


                      #11
                      Hello,

                      You can check for if the previous bar was a red candle if the closing price was lower than its opening price, and for a green candle if the close was higher than its opening price.

                      Open - https://ninjatrader.com/support/helpGuides/nt8/open.htm

                      Close - https://ninjatrader.com/support/help.../nt8/close.htm

                      Code:
                      if (Close[0] > Open[0])
                      
                      // candle is an up 'green' bar
                      Please let us know if we can assist further.

                      Comment


                        #12
                        Hi Gaby,

                        Finally Done! Thank you so much for your support!

                        Have a nice Day!

                        Comment


                          #13
                          Hi Gaby I would like to completely delete this post, could you do that? Thanks!

                          Comment


                            #14
                            Hello,

                            Unfortunately we do not delete forum posts.

                            Comment


                              #15
                              Hi Gaby,

                              Okey Thanks, one more question, by using the code:

                              Code:
                              if (State == State.Historical && CurrentBar < Count - 20)
                              
                              return;



                              It starts counting from the last 20 bars but I wolud like to update it so always are 20 bars displayed and not counting all the bars from the starting last 20...


                              Click image for larger version

Name:	image.png
Views:	411
Size:	59.8 KB
ID:	1273214

                              Thanks a lot!!!​

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              601 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              347 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
                              559 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              558 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X