Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Only on current bar.

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

    Only on current bar.

    I've got an indicator that shows me how high or low a range bar would have to reach before it went to the next bar. I use a hash mark to show that limit. I would like that hash mark to only appear on the current bar. I don't need it to populate on past data.

    How do I make the indicator show on only the current bar?

    Thanks in advance!

    Brian.

    #2
    Hello Brian,

    This depends on how you are adding that hashmark to the screen.

    If you are using DrawText(), then reuse the drawing object tag and this will move the object instead of duplicating it.

    DrawText("textBox", "Displayed text", 0, High[0] + 5 * TickSize, Color.Blue);
    ^ this will draw only on the current bar

    DrawText("textBox" + CurrentBar, "Displayed text", 0, High[0] + 5 * TickSize, Color.Blue);
    ^ this will draw on all bars

    From the help guide:
    "Tag: A user defined unique id used to reference the draw object. For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Here is my current code. This current version only prints a hash mark above each bar. I would like it to do both above and below but I've had problems with getting it to do both so I'm relegated to using two indicators right now. I am not using a DrawText function. I am just using a plot.

      Thanks!

      Code:
      protected override void Initialize()
              {
                  Add(new Plot(new Pen(Color.Black, 1), PlotStyle.Hash, "HighHash"));
                  Overlay				= true;
      			CalculateOnBarClose	= false;
      			
              }
      
      
              protected override void OnBarUpdate()
              {
      			if (CurrentBar<2) 
      				return;
      			
      			if (CurrentBar>=2)
      			{
      				HighHash.Set(Low[0] + ((barRange*.25) + .25));
      			}

      Comment


        #4
        Hello BReal,

        Once set, a plot will continue to have a value.

        To unset a value use DataSeries.Reset(int barsAgo);.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X