Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Create lines in the Chart from a list.

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

    Create lines in the Chart from a list.

    Hello, I have a list, to which I add price levels and I need to print all these lines and that they are not erased every time a new line appears, that they continue continuously on the chart.
    The code that I have only creates the last added line and deletes the previous one.





    protected override void OnBarUpdate()
    {

    if(cont>=_max){
    levelChangeList.Add(LastPrice); // Add to a list the prices that meet a certain condition
    }

    if(levelChangeList.Count > 0){
    for (int i = 0; i < levelChangeList.Count ; i++)
    {
    Draw.HorizontalLine(this, "tag1", levelChangeList[i], Brushes.Black); // what I need is that each price is printed in a continuous line and not erased.
    // With this code the previous ones are deleted every time there is a new one.
    // I need all the lines to be pushed all the time.
    }
    }

    }

    #2
    Hello iradielt,
    You should make the tag dynamic to retain all drawing objects, example : replace "tag1" with "tag1" + CurrentBar.
    Hope it helps!

    Comment


      #3
      Originally posted by s.kinra View Post
      Hello iradielt,
      You should make the tag dynamic to retain all drawing objects, example : replace "tag1" with "tag1" + CurrentBar.
      Hope it helps!
      Thank you very much, before I had a problem similar to this and I solved it as you say, I will try. Do you think that with this it will continue to show all the previous lines?

      Comment


        #4
        Hello iradielt,
        This is the standard behavior for Drawing Objects, they tend to retain unique tag names so if there is static tag it will always overwrite the older object & if dynamic tag is used it doesn't affects the older object & creates a new one. Hope it helps!

        Comment


          #5
          Originally posted by s.kinra View Post
          Hello iradielt,
          This is the standard behavior for Drawing Objects, they tend to retain unique tag names so if there is static tag it will always overwrite the older object & if dynamic tag is used it doesn't affects the older object & creates a new one. Hope it helps!
          I already solved it, thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          574 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          332 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