PINE LIBRARY
업데이트됨 MTFToolkit-Library

Library "MTFToolkit"
Multi-Timeframe Utilities Library: conversions, Fibonacci, TF sorting, MTF helpers, color gradients, demo table
timeframeToMinutes(tf)
Converts a timeframe string to minutes
Parameters:
tf (string): Timeframe string (e.g., "1", "15", "1D", "1W", "1M")
Returns: Number of minutes as float
minutesToTimeframe(minutes)
Converts minutes to a timeframe string
Parameters:
minutes (float): Number of minutes
Returns: Timeframe string
timeframeToSeconds(tf)
Converts a timeframe string to seconds
Parameters:
tf (string): Timeframe string
Returns: Number of seconds
secondsToTimeframe(seconds)
Converts seconds to a timeframe string
Parameters:
seconds (float): Number of seconds
Returns: Timeframe string
fiboGenerate(n)
Generates Fibonacci sequence up to n elements
Parameters:
n (int): Number of elements
Returns: Array of Fibonacci numbers
fiboMapToTV(arrFibo)
Maps Fibonacci values to TradingView timeframe strings
Parameters:
arrFibo (array<float>): Array of Fibonacci numbers
Returns: Array of timeframe strings
arrayMergeUnique(arr1, arr2)
Merges two string arrays and keeps unique values
Parameters:
arr1 (array<string>): First array
arr2 (array<string>): Second array
Returns: Merged array with unique strings
arrayFilterMax(arr, maxMinutes)
Filters TF array by max minutes
Parameters:
arr (array<string>): Array of timeframe strings
maxMinutes (float): Maximum allowed minutes
Returns: Filtered array
arraySortTF(tf_array, show_array, ascending)
Sorts TF array by minutes, optionally ascending
Parameters:
tf_array (array<string>): Array of timeframes
show_array (array<string>): Array of bool flags (for visibility)
ascending (bool)
masterTF(arr)
Returns the largest TF from array (master)
Parameters:
arr (array<string>): Array of TF strings
Returns: Master TF
slaveTF(arr)
Returns all TFs except master (slaves)
Parameters:
arr (array<string>): Array of TF strings
Returns: Array of slave TFs
isTFIncreasing(prevTF, nextTF)
Checks if next TF is larger than previous
Parameters:
prevTF (string): Previous timeframe
nextTF (string): Next timeframe
Returns: true if nextTF > prevTF
TFScore(values)
Computes simple average as score
Parameters:
values (array<float>): Array of float
Returns: Simple average (na if empty)
gradient_triangular(value, mid_point, min_color, mid_color, max_color)
Produces a triangular gradient between 3 colors
Parameters:
value (float): Current value (0–100 or any scale)
mid_point (float): Center point of gradient
min_color (color): Color at low end
mid_color (color): Color at midpoint
max_color (color): Color at high end
Returns: A color value
TFColorGradient(tf_val, min_val, max_val)
Timeframe color gradient helper
Converts a timeframe (in minutes) into a color using a
red → yellow → green gradient.
Parameters:
tf_val (float): Timeframe value in minutes
min_val (float): Minimum expected minutes
max_val (float): Maximum expected minutes
Returns: Color based on position between min_val and max_val
------------------------------------------------------------
TFColorGradientEx(tf_val, min_val, mid_val, max_val, low_color, mid_color, high_color)
Extended customizable timeframe gradient
Parameters:
tf_val (float): Timeframe value in minutes
min_val (float): Minimum minutes
mid_val (float): Middle minutes
max_val (float): Maximum minutes
low_color (color): Color at min_val
mid_color (color): Color at mid_val
high_color (color): Color at max_val
Returns: Color determined by TF position
------------------------------------------------------------
demoTable(tf_arr, show_arr, dashboard_position, horizontal_table, show_header)
Creates a demo table for testing TF arrays
Parameters:
tf_arr (array<string>): Array of TF strings
show_arr (array<bool>): Array of bools to show TFs
dashboard_position (string): Position string
horizontal_table (bool): true=horizontal, false=vertical
show_header (bool): Show header row
Multi-Timeframe Utilities Library: conversions, Fibonacci, TF sorting, MTF helpers, color gradients, demo table
timeframeToMinutes(tf)
Converts a timeframe string to minutes
Parameters:
tf (string): Timeframe string (e.g., "1", "15", "1D", "1W", "1M")
Returns: Number of minutes as float
minutesToTimeframe(minutes)
Converts minutes to a timeframe string
Parameters:
minutes (float): Number of minutes
Returns: Timeframe string
timeframeToSeconds(tf)
Converts a timeframe string to seconds
Parameters:
tf (string): Timeframe string
Returns: Number of seconds
secondsToTimeframe(seconds)
Converts seconds to a timeframe string
Parameters:
seconds (float): Number of seconds
Returns: Timeframe string
fiboGenerate(n)
Generates Fibonacci sequence up to n elements
Parameters:
n (int): Number of elements
Returns: Array of Fibonacci numbers
fiboMapToTV(arrFibo)
Maps Fibonacci values to TradingView timeframe strings
Parameters:
arrFibo (array<float>): Array of Fibonacci numbers
Returns: Array of timeframe strings
arrayMergeUnique(arr1, arr2)
Merges two string arrays and keeps unique values
Parameters:
arr1 (array<string>): First array
arr2 (array<string>): Second array
Returns: Merged array with unique strings
arrayFilterMax(arr, maxMinutes)
Filters TF array by max minutes
Parameters:
arr (array<string>): Array of timeframe strings
maxMinutes (float): Maximum allowed minutes
Returns: Filtered array
arraySortTF(tf_array, show_array, ascending)
Sorts TF array by minutes, optionally ascending
Parameters:
tf_array (array<string>): Array of timeframes
show_array (array<string>): Array of bool flags (for visibility)
ascending (bool)
masterTF(arr)
Returns the largest TF from array (master)
Parameters:
arr (array<string>): Array of TF strings
Returns: Master TF
slaveTF(arr)
Returns all TFs except master (slaves)
Parameters:
arr (array<string>): Array of TF strings
Returns: Array of slave TFs
isTFIncreasing(prevTF, nextTF)
Checks if next TF is larger than previous
Parameters:
prevTF (string): Previous timeframe
nextTF (string): Next timeframe
Returns: true if nextTF > prevTF
TFScore(values)
Computes simple average as score
Parameters:
values (array<float>): Array of float
Returns: Simple average (na if empty)
gradient_triangular(value, mid_point, min_color, mid_color, max_color)
Produces a triangular gradient between 3 colors
Parameters:
value (float): Current value (0–100 or any scale)
mid_point (float): Center point of gradient
min_color (color): Color at low end
mid_color (color): Color at midpoint
max_color (color): Color at high end
Returns: A color value
TFColorGradient(tf_val, min_val, max_val)
Timeframe color gradient helper
Converts a timeframe (in minutes) into a color using a
red → yellow → green gradient.
Parameters:
tf_val (float): Timeframe value in minutes
min_val (float): Minimum expected minutes
max_val (float): Maximum expected minutes
Returns: Color based on position between min_val and max_val
------------------------------------------------------------
TFColorGradientEx(tf_val, min_val, mid_val, max_val, low_color, mid_color, high_color)
Extended customizable timeframe gradient
Parameters:
tf_val (float): Timeframe value in minutes
min_val (float): Minimum minutes
mid_val (float): Middle minutes
max_val (float): Maximum minutes
low_color (color): Color at min_val
mid_color (color): Color at mid_val
high_color (color): Color at max_val
Returns: Color determined by TF position
------------------------------------------------------------
demoTable(tf_arr, show_arr, dashboard_position, horizontal_table, show_header)
Creates a demo table for testing TF arrays
Parameters:
tf_arr (array<string>): Array of TF strings
show_arr (array<bool>): Array of bools to show TFs
dashboard_position (string): Position string
horizontal_table (bool): true=horizontal, false=vertical
show_header (bool): Show header row
릴리즈 노트
v2Mis à jour:
timeframeToMinutes(tf)
Parameters:
tf (string)
minutesToTimeframe(minutes)
Parameters:
minutes (float)
timeframeToSeconds(tf)
Parameters:
tf (string)
secondsToTimeframe(seconds)
Parameters:
seconds (float)
fiboGenerate(n)
Parameters:
n (int)
fiboMapToTV(arrFibo)
Parameters:
arrFibo (array<float>)
arrayMergeUnique(arr1, arr2)
Parameters:
arr1 (array<string>)
arr2 (array<string>)
arrayFilterMax(arr, maxMinutes)
Parameters:
arr (array<string>)
maxMinutes (float)
arraySortTF(tf_array, show_array, ascending)
Parameters:
tf_array (array<string>)
show_array (array<string>)
ascending (bool)
masterTF(arr)
Parameters:
arr (array<string>)
slaveTF(arr)
Parameters:
arr (array<string>)
isTFIncreasing(prevTF, nextTF)
Parameters:
prevTF (string)
nextTF (string)
TFScore(values)
Parameters:
values (array<float>)
gradient_triangular(value, mid_point, min_color, mid_color, max_color)
Parameters:
value (float)
mid_point (float)
min_color (color)
mid_color (color)
max_color (color)
TFColorGradient(tf_val, min_val, max_val)
Parameters:
tf_val (float)
min_val (float)
max_val (float)
TFColorGradientEx(tf_val, min_val, mid_val, max_val, low_color, mid_color, high_color)
Parameters:
tf_val (float)
min_val (float)
mid_val (float)
max_val (float)
low_color (color)
mid_color (color)
high_color (color)
demoTable(tf_arr, show_arr, dashboard_position, horizontal_table, show_header)
Parameters:
tf_arr (array<string>)
show_arr (array<bool>)
dashboard_position (string)
horizontal_table (bool)
show_header (bool)
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
파인 라이브러리
트레이딩뷰의 진정한 정신에 따라, 작성자는 이 파인 코드를 오픈소스 라이브러리로 게시하여 커뮤니티의 다른 파인 프로그래머들이 재사용할 수 있도록 했습니다. 작성자에게 경의를 표합니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈소스 게시물에서 사용할 수 있지만, 이 코드의 게시물 내 재사용은 하우스 룰에 따라 규제됩니다.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.