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 adeelshahzad, Today, 03:54 AM
      0 responses
      0 views
      0 likes
      Last Post adeelshahzad  
      Started by CortexZenUSA, Today, 12:53 AM
      0 responses
      2 views
      0 likes
      Last Post CortexZenUSA  
      Started by CortexZenUSA, Today, 12:46 AM
      0 responses
      1 view
      0 likes
      Last Post CortexZenUSA  
      Started by usazencortex, Today, 12:43 AM
      0 responses
      5 views
      0 likes
      Last Post usazencortex  
      Started by sidlercom80, 10-28-2023, 08:49 AM
      168 responses
      2,266 views
      0 likes
      Last Post sidlercom80  
      Working...
      X