Time

Utilities for measuring time.
bar() Gets the number of milliseconds per bar.
Added:
date(datetime) Gets the start of the day for the provided time value.
Parameters:
datetime: The time of day to acquire the date from.
Returns: The number of milliseconds representing the date for the given value.
Added:
timeOfDay(datetime) Gets milliseconds from the start of the day.
Parameters:
datetime: The date/time to acquire the time of day from.
Returns: The number of milliseconds representing time of day.
Added:
spanToLen(timespan, type, sessionMinutes)
Returns the number (float) bars that represents the timespan provided.
Parameters:
timespan: The number of units to convert to bar count.
type: The type of units to measure. ('Bar', 'Minute' or 'Day')
sessionMinutes: Optional override for the number of minutes per session. (Default: Regular = 390, Extended = 1440)
Returns: The number bars that represents the timespan provided.
spanToIntLen(timespan, type)
Returns the number (int) bars that represents the timespan provided.
Parameters:
timespan: The number of units to convert to bar count.
type: The type of units to measure. ('Bar', 'Minute' or 'Day')
Returns: The number bars that represents the timespan provided.
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.
Declinazione di responsabilità
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.