Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot Line For Specific Bars

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

    Plot Line For Specific Bars

    Hello All.

    Let me explain what I'm trying to do, what I've done, and then ask my question.

    I'm trying to build an indicator for intraday use, mainly 15min chart, 5 min chart, etc. I'm looking at the forex market and i want to plot horizontal lines that show the high/low of the asian session, london's session and new york's session. I created a tradinghours/session template which correspond to the close of the various sessions and I can plot the high/low lines with no problem. The issue is that the high/low lines of the previous session are either too long or too short for the next session. I want to see the high/low of the asian session plotted as an overlay on the london session.

    I've got a decent programming background (mainly c++) so here's basically what my script does. I set up a few properties defining time in integers. For example, an int value for hours and an int value for minutes and then convert them into a datetime variable (mainly just a simplified way to easily adjust). I do this for the start time and the end time of the session i want to find the high/low from. After defining these time markers, I find the number of bars back from the current bar where the start time is and the same for the end time. This gives me an array of 'bars' to find the MIN() and MAX() from and then apply these values to the Plot(line)'s value property (Series<double>).

    I suspect the problem is because of something like the number of elements in the 'plot' or line object is the same (probably by default) as in the array used to determine the MIN/MAX. How can I change the number of elements in the plot or line object displayed on the chart? Can I even do that or do i need to create a new array or a new Plot which corresponds to the number of bars of the london session? Also, wondering if there was an easier way to do this using the 'tradinghours.session' template I already made. All the start/end times are already there, might be a bit cleaner to use that.

    I looked up the class/object models available but unfortunately I didn't find enough detail there to figure it out.

    Thanks,

    Brennan







    #2
    Hello bsalibrici,

    Welcome to the NinjaTrader support forum.

    For this type of question it may be easiest to take a screenshot of what you have currently as the result and then mark the chart for what you wanted to to look like. It sounds like from the description that something is not ligining up in what you are doing but I would likely need to see the code to better undersatnd the problem.

    I can say that you are not able to specify a number of indexes for a series or plot, that is determined by what it syncs with. In most cases that is the primary series, if you are adding additional data with other timeframes you will have series with different counts.

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

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