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 kinfxhk, 07-14-2026, 09:39 AM
      0 responses
      127 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 10:18 AM
      0 responses
      105 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 09:50 AM
      0 responses
      85 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-13-2026, 07:21 AM
      0 responses
      105 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 07-11-2026, 02:11 AM
      0 responses
      86 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X