Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
highlight a range candle
Collapse
X
-
Hello JamesBond,
Thank you for your note.
Assuming you're running the chart using an RTH template and not an ETH template, you could create an indicator that checks for the first bar of the session, records that CurrentBar index in a variable, then checks whether the bar it's currently processing is the Nth bar from the first bar of the session and does something to highlight it, for example changing the color.
Here's a very basic example:
private int firstBarOfSession;
protected override void OnBarUpdate()
{
if (Bars.IsFirstBarOfSession)
{
firstBarOfSession = CurrentBar;
}
if (CurrentBar == firstBarOfSession + 7)
BarBrush = Brushes.HotPink;
else
BarBrush = null;
}
If you're running on an ETH template this becomes more complex, as if you add an additional data series to the script with an RTH template the bars wouldn't line up with the ETH bars. So we'd then have to look at the bars by time, and it's unlikely an ETH bar would begin/end directly at the open time. So then you'd have to decide what bar would count as the first bar in the RTH session based on time, record the CurrentBar index, and then check if the bar being processed is the current bar you recorded + N bars.
Please let us know if we may be of further assistance to you.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
574 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
332 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
553 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
551 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment