Pine script quick scripts

First bar of the day (UTC)?

--

Detect if a new trading day has started. We do this by checking how many milliseconds have passed since the trading day started. Then we check if it is in our allowed time frame.

In this case, I want to flag true if we are at the close of the first bar (15min bar size):

time_trading_today = (time_close — time_tradingday) // in ms
if time_trading_today < 1000 * 60 * 16 //for 15min bars, adjust the last number to accout for the duration you want to cutoff after start of trading day. I put 16…

--

--

Dorien Herremans

Associate Professor at Singapore University of Technology and Design. Lead of the Audio, Music, and AI Lab (AMAAI)