PINE LIBRARY
Input Library [1CG]

Input Library (v1) – User Guide
Overview
The Input Library is a Pine Script® v6 utility library that standardizes and simplifies common user input patterns across indicators, strategies, and libraries.
It provides:
This library is designed to:
Library Declaration
To use the library in your script:
Pine Script®
Timezone Enums
Timezones
Provides a comprehensive list of IANA timezone identifiers using short, intuitive enum names.
Examples include:
Method: timezoneToString()
Resolves the enum to a valid timezone string.
Pine Script®
Behavior:
Time Formatting Enums
hours
Represents 24-hour values from "00" through "23".
minutes
Represents minute values from "00" through "59".
Function: combineTime()
Combines hour and minute enums into a "HHMM" formatted string.
Pine Script®
Example output:
Drawing Style Enums
The library standardizes visual input options and converts them into TradingView constants.
LineStyle
Method: lineStyle()
Pine Script®
LineSize
Method: lineSize()
Pine Script®
TextSize
Method: textSize()
Pine Script®
Box Alignment Enums
BoxHAlign
BoxVAlign
Methods:
Pine Script®
Line Extension
LineExtend
Method: lineExtend()
Pine Script®
Label Styles
LabelStyle
Method: labelStyle()
Pine Script®
String-Based Conversion Helpers
For compatibility with legacy scripts or string inputs:
These functions convert common string descriptions into valid TradingView constants.
Timezone Offset Utility
Function: getTZOffset()
Calculates the difference between a specified timezone and UTC.
Pine Script®
Returns:
Time Span Utility
Function: timeSpan()
Converts common span names into milliseconds.
Supported values:
Example:
Pine Script®
Best Practices
Limitations
Summary
The Input Library centralizes common input patterns into a reusable, structured framework. It improves script consistency, reduces UI friction, and ensures proper conversion between user selections and TradingView internal constants.
Designed for Pine Script® v6.
Overview
The Input Library is a Pine Script® v6 utility library that standardizes and simplifies common user input patterns across indicators, strategies, and libraries.
It provides:
- Predefined timezone enums mapped to IANA/Olson strings
- 24-hour and 60-minute enumerations
- Standardized line styles, sizes, label styles, and box alignment options
- Helper methods for converting enums into TradingView constants
- Utility functions for time formatting and span calculations
This library is designed to:
- Reduce repetitive input boilerplate
- Improve UI consistency across scripts
- Prevent string-based input errors
- Encourage clean, readable configuration logic
Library Declaration
To use the library in your script:
//@version=6
import OneCleverGuy/InputLibrary/1 as IL
Timezone Enums
Timezones
Provides a comprehensive list of IANA timezone identifiers using short, intuitive enum names.
Examples include:
- utc → "UTC"
- exch → Exchange timezone (syminfo.timezone)
- ny → "America/New_York"
- lon → "Europe/London"
- tokyo → "Asia/Tokyo"
- syd → "Australia/Sydney"
Method: timezoneToString()
Resolves the enum to a valid timezone string.
tzString = tzInput.timezoneToString()
Behavior:
- If Timezones.exch is selected, returns syminfo.timezone
- Otherwise returns the mapped IANA timezone string
Time Formatting Enums
hours
Represents 24-hour values from "00" through "23".
minutes
Represents minute values from "00" through "59".
Function: combineTime()
Combines hour and minute enums into a "HHMM" formatted string.
sessionTime = IL.combineTime(hourInput, minuteInput)
Example output:
- "0930"
- "1600"
Drawing Style Enums
The library standardizes visual input options and converts them into TradingView constants.
LineStyle
- solid
- dotted
- dashed
- lArrow
- rArrow
- bArrow
Method: lineStyle()
lineStyleValue = styleInput.lineStyle()
LineSize
- thin → 1px
- normal → 2px
- heavy → 3px
- thick → 4px
- wide → 5px
Method: lineSize()
width = sizeInput.lineSize()
TextSize
- auto
- tiny
- small
- normal
- large
- huge
Method: textSize()
textSizeValue = textSizeInput.textSize()
Box Alignment Enums
BoxHAlign
- left
- center
- right
BoxVAlign
- top
- center
- bottom
Methods:
hAlign = hAlignInput.boxHAlign()
vAlign = vAlignInput.boxVAlign()
Line Extension
LineExtend
- none
- right
- left
- both
Method: lineExtend()
extendValue = extendInput.lineExtend()
Label Styles
LabelStyle
- center
- down
- left
- right
- up
- lowLeft
- lowRight
- upperLeft
- upperRight
Method: labelStyle()
labelStyleValue = labelInput.labelStyle()
String-Based Conversion Helpers
For compatibility with legacy scripts or string inputs:
- lineStyleFromString()
- lineSizeFromString()
These functions convert common string descriptions into valid TradingView constants.
Timezone Offset Utility
Function: getTZOffset()
Calculates the difference between a specified timezone and UTC.
offset = IL.getTZOffset("America/New_York")
Returns:
- Millisecond difference between UTC and the specified timezone
- Accounts for daylight saving time
Time Span Utility
Function: timeSpan()
Converts common span names into milliseconds.
Supported values:
- "Minute"
- "Half Hour"
- "Hour"
- "4 Hours"
- "8 Hours"
- "12 Hours"
- "Day"
- "Week"
Example:
ms = IL.timeSpan("Hour")
Best Practices
- Prefer enums over raw strings for safer configuration
- Use conversion methods directly on enum inputs
- Standardize visual settings across scripts using shared enums
- Avoid hardcoding timezone strings where possible
Limitations
- timeSpan() supports predefined span names only
- getTZOffset() returns raw millisecond difference, not formatted hours
- Library does not enforce input validation beyond enum constraints
Summary
The Input Library centralizes common input patterns into a reusable, structured framework. It improves script consistency, reduces UI friction, and ensures proper conversion between user selections and TradingView internal constants.
Designed for Pine Script® v6.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.