PINE LIBRARY

Time Functions

Library "TimeFunctions"
Utility functions to handle time in Pine Script

TimeframetoInt()
Returns an int that corresponds to a timeframe string:
"1" => 1
"5" => 5
"10" => 10
"15" => 15
"30" => 30
"60" => 60
"H1" => 60
"H4" => 240
"1D" => 1440

BarsSinceOpen()
Returns the number of bars that have passed since the opening of the New York Session.
timesessions

Pine library

In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House rules.

Disclaimer