PINE LIBRARY
Telah dikemas kini

Time

2 845
Library "Time"
Utilities for measuring time.

bar() Gets the number of milliseconds per bar.
Nota Keluaran
v2 Added shortcut for getting the date.

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.
Nota Keluaran
v3

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.
Nota Keluaran
v4 Adds spanToLen functions
Nota Keluaran
v5

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.
Nota Keluaran
v6 improve spanToLen to allow for more types
Nota Keluaran
v7 cleanup bar() calculation
Nota Keluaran
v8: Improves Pine Script coding standards and allows for well defined
Pine Script®
TimeUnit
enum.

Updated:
spanToLen(timespan, unit, sessionMinutes)
  Returns the number (float) bars that represents the timespan provided.
  Parameters:
    timespan (simple float): The number of units to convert to bar count.
    unit (simple TimeUnit): The type of units to measure as a TimeUnit enum ('Bars', 'Seconds', 'Minutes', 'Days').
    sessionMinutes (simple int): 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, unit)
  Returns the number (int) bars that represents the timespan provided.
  Parameters:
    timespan (simple float): The number of units to convert to bar count.
    unit (simple TimeUnit): The type of units to measure as a TimeUnit enum ('Bars', 'Seconds', 'Minutes', 'Days').
  Returns: The number bars that represents the timespan provided.
Nota Keluaran
v9 Since the library's name is Time, TimeUnit seemed redundant as it would be accessed by Time.TimeUnit. Changed to just Unit.

Updated:
spanToLen(timespan, unit, sessionMinutes)
  Returns the number (float) bars that represents the timespan provided.
  Parameters:
    timespan (simple float): The number of units to convert to bar count.
    unit (simple Unit): The type of units to measure as a Unit enum ('Bars', 'Seconds', 'Minutes', 'Days').
    sessionMinutes (simple int): 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, unit)
  Returns the number (int) bars that represents the timespan provided.
  Parameters:
    timespan (simple float): The number of units to convert to bar count.
    unit (simple Unit): The type of units to measure as a Unit enum ('Bars', 'Seconds', 'Minutes', 'Days').
  Returns: The number bars that represents the timespan provided.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.