Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawHorizontalLine outside of bars makes line visible

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

    DrawHorizontalLine outside of bars makes line visible

    Hi;
    I have written a script to display horizontal lines based on input values. I use DrawHorizontalLine for this. What I have noticed is that if one of the lines is outside the current chart area, the window is automatically scalled to display the line.

    For example, I am displaying bars in the current window of $AUDUSD ranging from 1.017 to 1.028,
    One of my lines is defined to be displayed at 1.0330. Now when applying the indicator the chart compresses to fit in the line at 1.0330.

    I would like the line to only become visible when price reaches the area as is normal behaviour when placing a Horizontal Line on a chart. How can I achieve this in the indicator?

    I have attached a chart illustrating the problem;

    Thanks Thomas
    Attached Files

    #2
    Hello hometradingblog,
    You can do so if you set the auto scale property to false. For example the below code will not adjusts itself if the line is beyond the automatic scales price range.

    Code:
    this.DrawHorizontalLine("h", [B]false[/B], High[0] + 20 * TickSize, Color.Blue, DashStyle.Dash, 2);


    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Great thanks

      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