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 Mindset, 04-21-2026, 06:46 AM
|
0 responses
57 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
78 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
39 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
101 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
61 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment