Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing Horizontal Line from Script to Left Scale

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

    Drawing Horizontal Line from Script to Left Scale

    How do I get this

    IHorizontalLine hLine = DrawHorizontalLine("tag1", 1000, Color.Black);

    to use the left scale of the chart (which my oscillator is using in the same panel as the price data) ?

    thanks in advance!

    #2
    Hello kroeran,

    Thanks for your post.

    Within your code initialization, use ScaleJustification.Left

    Here is a link to the help guide section: http://www.ninjatrader.com/support/h...tification.htm

    Please let me know if I can be of further assistance.

    Comment


      #3
      the IHorizontalLine just sits under:

      protected override void OnBarUpdate()
      {
      IHorizontalLine hLine = DrawHorizontalLine("tag1", 1000, Color.Black);
      }

      without any Initialize() introduction, not following the model in the example below

      // Initialize method of a custom indicator
      protected override void Initialize()
      {
      Add(new Plot(Color.Orange, "SMA"));
      ScaleJustification = ScaleJustification.Left; // Indicator will be plotted on the left scale
      }

      Can't figure out how to convert it to Initialize section version
      Last edited by kroeran; 07-14-2014, 05:45 PM. Reason: clarification

      Comment


        #4
        Hello kroeran,

        Thanks for your post and question.

        The ScaleJustification would need to go into the initialize section which would be placed before OnbarUpdate.

        Here is an example:

        Code:
        protected override void Initialize() 
        {
        ScaleJustification = ScaleJustification.Left;  
        }


        After looking into this a bit more I found that you cannot have draw objects attached to any other scale but the price scale when drawing in the price panel. Said another way, regardless of how scaleJustification is set, draw objects will revert their scaling to the price scale.

        If you wish to have a static line or a Plot line, based on the left scale, you can do that through Add Line() or Add Plot(). Here is the help guide reference which contains examples: http://www.ninjatrader.com/support/h...x.html?add.htm

        Please let me know if you have any further questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        61 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        39 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        21 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        23 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        51 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X