I'm new here, and still learning to write pine. I have a very simple idea I'm trying to code that's been kicking my backside for weeks!
I want the background color for the last five bars to change only a condition has been met in the last 5 bars - the background color change is just to alert me "Hey, this is condition is new - give it a look" - like a visual alert. I don't want the background to be changed on any of the older bars to the left. If the condition was met > 6 bars ago I don't want the background changed anywhere on the chart. I've tried subtracting 60k (milliseconds) * 5 from timenow and it won't work. Any help will be SUPER appreciated!!! Many thanks, -Daniel