Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Extending a Line forward

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

    Extending a Line forward

    I am trying to get NT to extend a line on the high of a current bar to go 3 bars to the right at the same price. My code is

    DrawLine("MyLine"+CurrentBar, 1, High[0], 0, High[0], Color.Blue, DashStyle.Dot, 4);

    This will only draw a line on the current bar and not the future 3 bars at the same price.

    Any thoughts on how to do this?

    thanks

    Steve

    #2
    Future bar drawing is currently not available in the sense that you cannot draw a line to fill the place of where the future bars will be plotted into.

    What you can do is plot the line for the next 3 bars as the bars become populated though. To achieve this you will need to determine the condition in which you want to draw the line then set a switch that will be active for 3 bars and inside that switch you will draw the line, each time modifying the startBars parameter to match the latest bar.

    Here is some untested code
    Code:
    if (Close[0] > Open[0])
         drawLineSet = 1;
    while (drawLineSet <= 3)
    {
         DrawLine("MyLine", drawLineSet, High[drawLineSet - 1], drawLineSet - 1, High[drawLineSet - 1], Color.Blue, DashStyle.Dot, 4);
         drawLineSet++;
    }
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the suggestion

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      177 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      332 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      254 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      356 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      184 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X