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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      164 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      318 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      246 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X