Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Automatically Plotting Ray

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

    Automatically Plotting Ray

    I would like to know how to automatically have a ray plotted from the close of one bar to the next.

    For example, I want the ray to start plotting at the close of a bar at 9 AM the previous day to the close of 9 AM on the current day.

    #2
    Hi Trend Methods,

    Thanks for your post.

    Are you wanting this on a Daily chart (close of one bar to the next) or are you wanting this to span a minute chart from the one bar to another specified bar?

    Are you wanting this ray to draw after a 9:00 bar is drawn from the previous 9:00 bar to the current 9:00 bar or are you wanting this to continuously update from 9:00 the previous day to the current bar?

    Are you wanting this ray to be drawn multiple times or are you wanting the ray to be moved to the new location once there is a new 9:00 bar?

    To draw a ray you will need to use DrawRay(). Below is a link to the help guide on DrawRay().
    http://www.ninjatrader.com/support/h...t7/drawray.htm

    For example:
    Code:
    DateTime barDateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 9, 0, 0);
    if (Time[CurrentBar-Bars.GetBar(barDateTime.AddDays(-1))] == barDateTime || ToTime(Time[CurrentBar-Bars.GetBar(barDateTime.AddDays(-1))]) != ToTime(barDateTime))
    return;
    
    if (Time[0] == barDateTime)
    DrawRay("ray", false, barDateTime.AddDays(-1), Close[CurrentBar-Bars.GetBar(barDateTime.AddDays(-1))], Time[0], Close[0], Color.Blue, DashStyle.Solid, 3);
    This code would draw one line from yesterday's 9:00 AM bar to today's 9:00 AM bar.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

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