Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 trilliantrader, Today, 03:01 PM
      2 responses
      17 views
      0 likes
      Last Post helpwanted  
      Started by ScottWalsh, Today, 06:52 PM
      2 responses
      15 views
      0 likes
      Last Post ScottWalsh  
      Started by cre8able, Today, 07:24 PM
      0 responses
      1 view
      0 likes
      Last Post cre8able  
      Started by Haiasi, Today, 06:53 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by ScottW, Today, 06:09 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Working...
      X