Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

highlight a range candle

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

    highlight a range candle

    I use a 20 tick range chart for RTY. Is there a way to highlight a candle Nth from the market open? For example, I'd like to highlight the 7th 20 tick range candle from US open(9:30am). Is this possible?

    #2
    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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    82 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    43 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Working...
    X