Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 junkone, Yesterday, 02:19 PM
      5 responses
      67 views
      1 like
      Last Post junkone
      by junkone
       
      Started by reynoldsn, Today, 07:19 PM
      0 responses
      5 views
      0 likes
      Last Post reynoldsn  
      Started by reynoldsn, 04-21-2024, 07:53 PM
      2 responses
      16 views
      0 likes
      Last Post reynoldsn  
      Started by stafe, 04-15-2024, 08:34 PM
      13 responses
      83 views
      0 likes
      Last Post stafe
      by stafe
       
      Started by ezrollin, 02-26-2022, 11:14 PM
      4 responses
      191 views
      0 likes
      Last Post kenz987
      by kenz987
       
      Working...
      X