Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Horizontal line draw error

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

    Horizontal line draw error

    Hello,

    I'm trying to code an indicator to draw an unlocked horizontal line on the chart which the user can then move around while the indicator still knows what price the line is at currently.

    Using these globals:
    private double LinePrice = 0;
    IHorizontalLine Line = null;

    And here in OnBarUpdate:
    if (Line == null)
    {
    Line = DrawHorizontalLine("Line1", true, Close[1], Color.White, DashStyle.Dash, 1);
    Line.Locked = false;
    }

    LinePrice = Line.Y;

    This code is working fine for my purpose, except that the line does NOT initially draw at Close[1]. Instead it draws at some random location on the chart, which is sometimes very far away from price. How can I get the line to draw at Close[1] and stay there till I move it?

    Thanks!
    Last edited by entropy; 09-24-2015, 12:44 PM.

    #2
    Hello entropy,

    Thank you for your post.

    The snippet of code you provided should produce your desired results. Can you attach the full script or a test version that produces the same result?

    Comment


      #3
      Thanks for confirming! I'll have to dig up the answer in the rest of the code.

      Comment

      Latest Posts

      Collapse

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