Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw Extended Line From Start to End Date.

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

    Draw Extended Line From Start to End Date.

    Hi,

    I'm trying to figure out how to draw an extended line from a starting date to an ending date to be used for an indicator panel - lets say the ADL indicator. I've been working with the code below which works on the price panel based on a comparison of 10 bars back to present bar.. Thanks so much for your help..


    if (CurrentBar < 10)return;

    if (WilliamsR (14)[0] < -50 )
    DrawExtendedLine("tag1", false, 10, High[10], 0, High[0], Color.Blue, DashStyle.Solid, 1);

    #2
    Hi Shawn,

    You can use .nets built in DateTime structure in NinjaScript. For working with extended line DateTime overloads, you place a date time object where expected. Help for working with DateTime objects is here:


    Example:
    Code:
    #region Variables
    private DateTime myDateTime = new DateTime(2011, 8, 11, 12, 0, 0);
    #endregion
    
    protected override void OnBarUpdate()
    {
    DrawExtendedLine("myELine", true, myDateTime, High[0], myDateTime.AddDays(1), High[0], Color.Blue, DashStyle.Solid, 2);
    }
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Feedback

      Hi Ryan,

      THanks for your feedback. I wanted to use this extended line for an indicator panel - not sure how to do that. I tried inserting the sample code you sent - but it didn't work . I'm probably doing something wrong... What would be the procedure for building this indicator?

      Comment


        #4
        That's a simple example, but you can modify the Y values for the indicator you want to draw the values at.

        If you want the indicator's default panel to be something other than price, can add Overlay = false; to the script's Initialize() method.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by Shawn View Post
          Hi Ryan,

          THanks for your feedback. I wanted to use this extended line for an indicator panel - not sure how to do that. I tried inserting the sample code you sent - but it didn't work . I'm probably doing something wrong... What would be the procedure for building this indicator?
          It sounds as if your line is not being drawn in the panel as you expect?

          If that is the case, you will need

          Code:
           
          DrawOnPricePanel = false;
          in your Initialize() method.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          598 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
          555 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X