canerbanana
canerbanana

Reputation: 1

Highlight Every 5 Minute Candle in Pine Script

I only want to highlight every XX:05 & XX:35 Minute candle during a 24H Trading Session (Up Candle Green and Down Candle Red)

Example: 16:05 Candle Green 16:35 Candle Red 17:05 Candle Red 17:35 Candle Green

and so on for the whole trading day.

Upvotes: 0

Views: 946

Answers (1)

vitruvius
vitruvius

Reputation: 21159

You can use the minute built-in variable to figure out the current bar minute.

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © vitruvius

//@version=5
indicator("05", overlay=true)

is_05 = (minute % 5) == 0

bgcolor(is_05 ? color.new(color.blue, 85) : na)

enter image description here

Upvotes: 1

Related Questions