Pineify

common

Pineify 已更新   
The "Pineify/common" library presents a specialized toolkit crafted to empower traders and script developers with state-of-the-art time manipulation functions on the TradingView platform. It is instead a foundational utility aimed at enriching your script's ability to process and interpret time-based data with unparalleled precision.

Key Features


String Splitter:

The 'str_split_into_two' function is a universal string handler that separates any given input into two distinct strings based on a specified delimiter. This function is especially useful in parsing time strings or any scenario where a string needs to be divided into logical parts efficiently.

Example:

[a, b] = str_split_into_two("a:b", ":")
// a = "a"
// b = "b"


Time Parser:

With 'time_to_hour_minute', users can effortlessly convert a time string into numerical hours and minutes. This function is pivotal for those who need to exact specific time series data or wish to schedule their trades down to the minute.

Example:

[time_hour, time_minute] = time_to_hour_minute("02:30")
// time_hour = 2
// time_minute = 30

Unix Time Converter

The 'time_range_to_unix_time' function transcends traditional boundaries by converting a given time range into Unix timestamp format. This integration of date, time, and timezone, accounts for a comprehensive approach, allowing scripts to make timed decisions, perform historical analyses, and account for international markets across different time zones.

Example:

// Support 'hhmm-hhmm' and 'hh:mm-hh:mm'
[start_unix_time, end_unix_time] = time_range_to_unix_time("09:30-12:00")

Summary:

Each function is meticulously designed to minimize complexity and maximize versatility. Whether you are a programmer seeking to streamline your code, or a trader requiring precise timing for your strategies, our library provides the logical framework that aligns with your needs.

The "Pineify/common" library is the bridge between high-level time concepts and actionable trading insights. It serves a multitude of purposes – from crafting elegant time-based triggers to dissecting complex string data. Embrace the power of precision with "Pineify/common" and elevate your TradingView scripting experience to new heights.
版本注释:
v2

Added:
time_range_to_start_unix_time(time_range, date_time, timezone)
  Convert the time range to start unix time
  Parameters:
    time_range (string): timeRange
    date_time (int): The Unix timestamp for the date.
    timezone (string): Timezone
  Returns: start_unix_time

time_range_to_end_unix_time(time_range, date_time, timezone)
  Convert the time range to end unix time
  Parameters:
    time_range (string): timeRange
    date_time (int): The Unix timestamp for the date.
    timezone (string): Timezone
  Returns: end_unix_time
版本注释:
v3

Added:
timeframe_to_seconds(tf)
  Convert the timeframe to seconds
  Parameters:
    tf (simple string): timeframe
  Returns: seconds
Pine脚本库

本着真正的TradingView精神,作者将此Pine代码以开源脚本库发布,以便我们社区的其他Pine程序员可以重用它。向作者致敬!您可以私下或在其他开源出版物中使用此库,但在出版物中重用此代码受网站规则约束。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想使用这个脚本库吗?

复制以下行并将其粘贴到您的脚本中。