Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

drawing a vertial line the price assigned to a double

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

    drawing a vertial line the price assigned to a double

    Is it possible to draw a vertical line from the current bar to the price assigned to a double from another time frame using an indicator/strategy? If so, can you provide the syntax for this. I did not see it when I reviewed the support guide.

    #2
    Hello gordongekko,

    Thanks for opening the thread.

    It is possible to draw a line to any price level. The question would be how you plan on getting the data from another time frame. You could add an additional data series to get the price values from another instrument, and use those price values to dictate the price level your line's endpoints should be. This would be the supported way of accessing data from another time frame in a NinjaScript.

    Code:
    Draw.Line(this, "tag1", false, 0, [B]Closes[0][0][/B], 0, [B]Closes[1][0][/B], Brushes.LimeGreen, DashStyleHelper.Dot, 2);
    Please be sure to review the Multi Series NinjaScripts documentation as it covers all of the ins and outs of a Multi Series NinjaScript.

    Multi Series NinjaScripts (Important read!) - https://ninjatrader.com/support/help...nstruments.htm

    Please elt me know if you have any questions.

    Comment


      #3
      Hi Jim,

      Thanks for the reply, When I use that syntax and plug in a double containing the closing price of a bar from a higher time frame I'm not seeing it on the chart.

      Draw.Line(this, "tag1", false, 0, Closes[0][0], 0, htfhigh, Brushes.LimeGreen, DashStyleHelper.Dot, 2);

      htfhigh is a double that contains a closing price from a bar obtained via a method using barsinprogress == 1 in the past that is far enough back to where the data is accessible from the primary data series so I'm not sure why its it not showing up on the chart.

      Comment


        #4
        Hello gordongekko,

        I can offer some advise to help you debug this. We should start by asking the following questions:
        1. When testing, were you able to see the Draw.Line() appear when using Closes[0][0] and Closes[1][0]? How about when using numbers as input?
        2. Are you able to see the line when you have the auto scale parameter set to true?
        3. Lastly, there could another issue where the NinjaScript errors out and no longer performs any action. Do you see any errors in the log tab of the Control Center?


        Adding prints for Closes[0][0] and htfhigh above the Draw.Line() can tell you:
        1. if the Draw.Line() is reached
        2. if the input going into the Draw.Line() is valid and what you should expect visually


        Please also note that DashStyleHelper.Dot would create a dotted line. DashStyleHelper.Line would create a solid line. I've included documentation links for Draw.Line() for reference as well as debugging tips that we have on our forums.

        Draw.Line() - https://ninjatrader.com/support/help.../draw_line.htm

        Debugging - https://ninjatrader.com/support/foru...ead.php?t=3418

        Making sure you have enough bars (See "Accessing Price data in a Multi Series NinjaScript" for MultiSeries application) - https://ninjatrader.com/support/foru...ead.php?t=3170

        Accessing Price data in a Multi Series NinjaScript - https://ninjatrader.com/support/help...arsninjascript

        Please let us know if you need further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        569 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        548 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X