Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Keep drawings on the previous bars

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

    Keep drawings on the previous bars

    Hi,

    I am drawing a diamond from my indicator within the OnBarUpdate method on the most recent bar, however, once the bar closes and the next one starts the diamond moves to the new recent bar. I would like to keep my initial drawing as is and have a new drawing on the new bar.

    On a similar note, I want to be able to add my drawings to all the bars on the chart once I run my indicator. But, with the OnBarUpdate method, I can only target one specific bar.

    Code:
    protected override void OnBarUpdate()
            {   
                if (myCondition)
                {
                    Draw.Diamond(this, "tag1", true, -1, Low[0] - TickSize, Brushes.Magenta, true);
                } 
            }​

    #2
    Hello pouya-p,

    To have unique objects you need to use unique tags. You can append CurrentBar to the tag to make them unique:

    "tag1" + CurrentBar

    That will allow the objects to remain on the bars that have been processed.

    Comment


      #3
      Hi Jesse,

      Thanks, this was really helpful.

      Regards,
      Pouya

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      576 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
      553 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