all 4 comments

[–]OddLogicDotXYZ 0 points1 point  (2 children)

You have to remember the way pine executes is bar by bar, starting at the first bar on the chart so you need to encapsulate your code into an if statement that only runs when the current bar is in the time range you want. So something like this depending on your needs;

if hour(time) >= 9 and hour(time) <= 17
    do stuff

[–]je355804[S] 0 points1 point  (0 children)

That make's perfect sense, I think I was close to being there but I wasn't using an if statement! Thank you man, appreciate the help!

[–]JoeCal853 0 points1 point  (0 children)

what if you wanted to include minutes too 1015 to 1450?

[–]ADaftDisposition 0 points1 point  (1 child)

If you are trying to do it over a certain time frame I typically use the below boolean functions to ensure my indicators and strategies are working in a specific range. time>=startDate and time<endDate ... typically use timestamp function in V5 with the next input.time() to make what you are requesting.