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.
    Paul H.NinjaTrader Customer Service

    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.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by FrancisMorro, Today, 03:24 AM
        0 responses
        1 view
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,770 views
        0 likes
        Last Post Leafcutter  
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        31 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        944 views
        0 likes
        Last Post spwizard  
        Started by Max238, Today, 01:28 AM
        0 responses
        11 views
        0 likes
        Last Post Max238
        by Max238
         
        Working...
        X