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 fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,404 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        95 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by DJ888, Yesterday, 10:57 PM
        0 responses
        7 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        159 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        8 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X