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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      93 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      138 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      123 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      73 views
      0 likes
      Last Post PaulMohn  
      Working...
      X