PINE LIBRARY
已更新 Time

Library "Time"
Utilities for measuring time.
bar() Gets the number of milliseconds per bar.
Utilities for measuring time.
bar() Gets the number of milliseconds per bar.
版本注释
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.
版本注释
v3Added:
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.
版本注释
v4 Adds spanToLen functions版本注释
v5Added:
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.
版本注释
v6 improve spanToLen to allow for more types版本注释
v7 cleanup bar() calculation版本注释
v8: Improves Pine Script coding standards and allows for well defined TimeUnit
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.
版本注释
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.
版本注释
v10 Fix Default Session MinutesRemoved Week, Month, Year options as they will be subjectively inaccurate.
Added:
getDefaultSessionMinutes()
Returns the default session length in minutes based on syminfo.type and syminfo.session
Returns: Integer session length in minutes (e.g. 390, 1380, 1440)
版本注释
v11 Bug fixPine脚本库
本着真正的TradingView精神,作者将此Pine代码发布为开源库,以便我们社区的其他Pine程序员可以重复使用它。向作者致敬!您可以私密或在其他开源出版物中使用此库,但在出版物中重复使用此代码受网站规则约束。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
Pine脚本库
本着真正的TradingView精神,作者将此Pine代码发布为开源库,以便我们社区的其他Pine程序员可以重复使用它。向作者致敬!您可以私密或在其他开源出版物中使用此库,但在出版物中重复使用此代码受网站规则约束。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。