Pineify Uppdaterad   
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.


[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.


[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.


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


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.

time_range_to_start_unix_time(time_range, date_time, timezone)
  Convert the time range to start unix time
    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
    time_range (string): timeRange
    date_time (int): The Unix timestamp for the date.
    timezone (string): Timezone
  Returns: end_unix_time

  Convert the timeframe to seconds
    tf (simple string): timeframe
  Returns: seconds

📈📈📈 Building TradingView Indicators with visual tools:

🔥🔥🔥 Free Playground:

Pineify Discord:

I sann TradingView-anda har författaren publicerat denna Pine-kod som ett bibliotek med öppen källkod så att andra Pine-programmerare från vår community kan återanvända den. Hatten av för författaren! Du kan använda det här biblioteket privat eller i andra publikationer med öppen källkod, men återanvändning av den här koden i en publikation regleras av våra ordningsregler.

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Vill du använda det här biblioteket?

Kopiera följande rad och klistra in det i ditt skript.