PINE LIBRARY
Cập nhật VolumaticDataLibrary

Library "VolumaticDataLibrary"
norm(src)
Normalizes a value if mean is 0
This function does not access global variables.
Parameters:
src (float)
addVolumeNodeIfSignificant(level, line_amount, node_prices, node_volumes, node_colors, color_up, color_dn, src_open, src_high, src_low, src_close, src_volume)
Processes the current bar's data to see if it represents a significant volume node,
and if so, updates the provided arrays with the node data.
This function should be called on every bar from the consuming indicator/strategy.
Parameters:
level (float): The sensitivity level for detecting nodes.
line_amount (int): The maximum number of nodes to store.
node_prices (array<float>): Array to store node prices (passed by reference).
node_volumes (array<float>): Array to store node absolute volumes (passed by reference).
node_colors (array<color>): Array to store node colors (passed by reference).
color_up (color): The color to use for upward significant volume.
color_dn (color): The color to use for downward significant volume.
src_open (float): The open price series from the calling script.
src_high (float): The high price series from the calling script.
src_low (float): The low price series from the calling script.
src_close (float): The close price series from the calling script.
src_volume (float): The volume series from the calling script.
createVolumeNodeArray(node_prices, node_volumes, node_colors)
Creates an array of VolumeNode objects from the provided separate arrays.
This function can be called on the last bar from the consuming indicator/strategy
to get the current list of significant volume nodes.
Parameters:
node_prices (array<float>): Array containing the prices of the nodes.
node_volumes (array<float>): Array containing the absolute volumes of the nodes.
node_colors (array<color>): Array containing the colors of the nodes.
Returns: An array of VolumeNode objects representing the stored volume nodes.
VolumeNode
Fields:
price (series float)
volume (series float)
node_color (series color)
norm(src)
Normalizes a value if mean is 0
This function does not access global variables.
Parameters:
src (float)
addVolumeNodeIfSignificant(level, line_amount, node_prices, node_volumes, node_colors, color_up, color_dn, src_open, src_high, src_low, src_close, src_volume)
Processes the current bar's data to see if it represents a significant volume node,
and if so, updates the provided arrays with the node data.
This function should be called on every bar from the consuming indicator/strategy.
Parameters:
level (float): The sensitivity level for detecting nodes.
line_amount (int): The maximum number of nodes to store.
node_prices (array<float>): Array to store node prices (passed by reference).
node_volumes (array<float>): Array to store node absolute volumes (passed by reference).
node_colors (array<color>): Array to store node colors (passed by reference).
color_up (color): The color to use for upward significant volume.
color_dn (color): The color to use for downward significant volume.
src_open (float): The open price series from the calling script.
src_high (float): The high price series from the calling script.
src_low (float): The low price series from the calling script.
src_close (float): The close price series from the calling script.
src_volume (float): The volume series from the calling script.
createVolumeNodeArray(node_prices, node_volumes, node_colors)
Creates an array of VolumeNode objects from the provided separate arrays.
This function can be called on the last bar from the consuming indicator/strategy
to get the current list of significant volume nodes.
Parameters:
node_prices (array<float>): Array containing the prices of the nodes.
node_volumes (array<float>): Array containing the absolute volumes of the nodes.
node_colors (array<color>): Array containing the colors of the nodes.
Returns: An array of VolumeNode objects representing the stored volume nodes.
VolumeNode
Fields:
price (series float)
volume (series float)
node_color (series color)
Phát hành các Ghi chú
v2Added:
calculateVolumePercentages(node_volumes, vol_perc)
Calculates the volume percentages for the stored volume nodes.
Populates the provided vol_perc array.
Parameters:
node_volumes (array<float>): Array containing the absolute volumes of the nodes.
vol_perc (array<float>): Array to populate with volume percentages.
Updated:
addVolumeNodeIfSignificant(level, line_amount, node_prices, node_volumes, node_signed_volumes, node_colors, node_bar_indices, color_up, color_dn, src_open, src_high, src_low, src_close, src_volume)
Processes the current bar's data to see if it represents a significant volume node,
and if so, updates the provided arrays with the node data.
This function should be called on every bar from the consuming indicator/strategy.
Parameters:
level (float): The sensitivity level for detecting nodes.
line_amount (int): The maximum number of nodes to store.
node_prices (array<float>): Array to store node prices (passed by reference).
node_volumes (array<float>): Array to store node absolute volumes (passed by reference).
node_signed_volumes (array<float>): Array to store node signed volumes (passed by reference).
node_colors (array<color>): Array to store node colors (passed by reference).
node_bar_indices (array<int>): Array to store node bar indices (passed by reference).
color_up (color): The color to use for upward significant volume.
color_dn (color): The color to use for downward significant volume.
src_open (float): The open price series from the calling script.
src_high (float): The high price series from the calling script.
src_low (float): The low price series from the calling script.
src_close (float): The close price series from the calling script.
src_volume (float): The volume series from the calling script.
createVolumeNodeArray(node_prices, node_volumes, node_signed_volumes, node_colors, node_bar_indices)
Creates an array of VolumeNode objects from the provided separate arrays.
This function can be called on the last bar from the consuming indicator/strategy
to get the current list of significant volume nodes.
Parameters:
node_prices (array<float>): Array containing the prices of the nodes.
node_volumes (array<float>): Array containing the absolute volumes of the nodes.
node_signed_volumes (array<float>): Array containing the signed volumes of the nodes.
node_colors (array<color>): Array containing the colors of the nodes.
node_bar_indices (array<int>): Array containing the bar indices of the nodes.
Returns: An array of VolumeNode objects representing the stored volume nodes.
VolumeNode
Fields:
price (series float)
volume (series float)
signed_volume (series float)
node_color (series color)
bar_index (series int)
Phát hành các Ghi chú
v3Added:
getVolatilityLevelString(atr_delta, low_threshold, medium_threshold, high_threshold)
Determines the volatility level string based on the ATR Delta value and thresholds.
Parameters:
atr_delta (float): The current ATR Delta value.
low_threshold (float): The upper bound for "Low Volatility".
medium_threshold (float): The upper bound for "Medium Volatility".
high_threshold (float): The upper bound for "High Volatility".
Returns: A string representing the volatility level ("Low", "Medium", "High", "Very High").
getSignalsOnCrossings(nodes_array, current_close, prev_close, current_atr_delta, current_signal_line, alert_volatility_condition)
Checks if the current price has crossed any of the provided volume node levels
and if the specified volatility condition is met, returns signal information.
Parameters:
nodes_array (array<VolumeNode>): Array of VolumeNode objects to check crossings against.
current_close (float): The current bar's close price.
prev_close (float): The previous bar's close price.
current_atr_delta (float): The current ATR Delta value from the calling script.
current_signal_line (float): The current ATR Delta signal line value from the calling script.
alert_volatility_condition (string): The type of volatility condition to check for signals.
Returns: An array of SignalInfo objects for any levels crossed that meet the signal criteria.
SignalInfo
Fields:
node (VolumeNode)
direction (series string)
volatility_condition_met (series string)
Updated:
addVolumeNodeIfSignificant(level, line_amount, node_prices, node_volumes, node_signed_volumes, node_colors, node_bar_indices, node_atr_deltas, node_volatility_levels, color_up, color_dn, current_atr_delta, current_volatility_level_string, src_open, src_high, src_low, src_close, src_volume)
Processes the current bar's data to see if it represents a significant volume node,
and if so, updates the provided arrays with the node data.
This function should be called on every bar from the consuming indicator/strategy.
Parameters:
level (float): The sensitivity level for detecting nodes.
line_amount (int): The maximum number of nodes to store.
node_prices (array<float>): Array to store node prices (passed by reference).
node_volumes (array<float>): Array to store node absolute volumes (passed by reference).
node_signed_volumes (array<float>): Array to store node signed volumes (passed by reference).
node_colors (array<color>): Array to store node colors (passed by reference).
node_bar_indices (array<int>): Array to store node bar indices (passed by reference).
node_atr_deltas (array<float>): Array to store node ATR Delta values (passed by reference).
node_volatility_levels (array<string>): Array to store node volatility level strings (passed by reference).
color_up (color): The color to use for upward significant volume.
color_dn (color): The color to use for downward significant volume.
current_atr_delta (float): The current ATR Delta value from the calling script.
current_volatility_level_string (string): The current volatility level string from the calling script.
src_open (float): The open price series from the calling script.
src_high (float): The high price series from the calling script.
src_low (float): The low price series from the calling script.
src_close (float): The close price series from the calling script.
src_volume (float): The volume series from the calling script.
createVolumeNodeArray(node_prices, node_volumes, node_signed_volumes, node_colors, node_bar_indices, node_atr_deltas, node_volatility_levels)
Creates an array of VolumeNode objects from the provided separate arrays.
This function can be called from the consuming indicator/strategy
to get the current list of significant volume nodes.
Parameters:
node_prices (array<float>): Array containing the prices of the nodes.
node_volumes (array<float>): Array containing the absolute volumes of the nodes.
node_signed_volumes (array<float>): Array containing the signed volumes of the nodes.
node_colors (array<color>): Array containing the colors of the nodes.
node_bar_indices (array<int>): Array containing the bar indices of the nodes.
node_atr_deltas (array<float>): Array to store node ATR Delta values.
node_volatility_levels (array<string>): Array to store node volatility level strings.
Returns: An array of VolumeNode objects representing the stored volume nodes.
VolumeNode
Fields:
price (series float)
volume (series float)
signed_volume (series float)
node_color (series color)
bar_index (series int)
atr_delta (series float)
volatility_level (series string)
Phát hành các Ghi chú
v4Phát hành các Ghi chú
v5Phát hành các Ghi chú
v6Updated:
addVolumeNodeIfSignificant(level, line_amount, node_prices, node_volumes, node_signed_volumes, node_colors, node_bar_indices, node_atr_deltas, node_volatility_levels, color_up, color_dn, current_atr_delta, current_volatility_level_string, src_open, src_high, src_low, src_close, src_volume)
Processes a potential volume node and adds it to the provided arrays
if it meets the criteria and there is space or it's more significant
than an existing node. Uses a LIFO buffer management approach on the passed arrays.
This function should be called on every bar from the consuming indicator/strategy.
Parameters:
level (float): The sensitivity level for detecting nodes.
line_amount (int): The maximum number of nodes to store in the buffer.
node_prices (array<float>): Array to store node prices (passed by reference from indicator).
node_volumes (array<float>): Array to store node absolute volumes (passed by reference from indicator).
node_signed_volumes (array<float>): Array to store node signed volumes (passed by reference from indicator).
node_colors (array<color>): Array to store node colors (passed by reference from indicator).
node_bar_indices (array<int>): Array to store node bar indices (passed by reference from indicator).
node_atr_deltas (array<float>): Array to store node ATR Delta values (passed by reference from indicator).
node_volatility_levels (array<string>): Array to store node volatility level strings (passed by reference from indicator).
color_up (color): The color to use for upward significant volume.
color_dn (color): The color to use for downward significant volume.
current_atr_delta (float): The current ATR Delta value from the calling script.
current_volatility_level_string (string): The current volatility level string from the calling script.
src_open (float): The open price series from the calling script.
src_high (float): The high price series from the calling script.
src_low (float): The low price series from the calling script.
src_close (float): The close price series from the calling script.
src_volume (float): The volume series from the calling script.
Modified function signature to accept arrays
createVolumeNodeArray(node_prices, node_volumes, node_signed_volumes, node_colors, node_bar_indices, node_atr_deltas, node_volatility_levels)
Creates and returns an array of VolumeNode objects from the provided separate arrays.
This function is called by the consuming indicator/strategy
to get the current list of significant volume nodes managed by the indicator.
Parameters:
node_prices (array<float>): Array containing the prices of the nodes (passed by reference from indicator).
node_volumes (array<float>): Array containing the absolute volumes of the nodes (passed by reference from indicator).
node_signed_volumes (array<float>): Array containing the signed volumes of the nodes (passed by reference from indicator).
node_colors (array<color>): Array containing the colors of the nodes (passed by reference from indicator).
node_bar_indices (array<int>): Array containing the bar indices of the nodes (passed by reference from indicator).
node_atr_deltas (array<float>): Array to store node ATR Delta values (passed by reference from indicator).
node_volatility_levels (array<string>): Array to store node volatility level strings (passed by reference from indicator).
Returns: An array of VolumeNode objects representing the stored volume nodes.
Modified function signature to accept arrays
calculateVolumePercentages(nodes_array)
Calculates the volume percentages for a provided array of VolumeNode objects.
Parameters:
nodes_array (array<VolumeNode>): Array of VolumeNode objects.
Returns: An array of floats representing the volume percentage for each node.
Phát hành các Ghi chú
v7Added:
lorentzianTrend(src, length, smoothing)
Calculates the Lorentzian Trend.
Parameters:
src (float): The source series (e.g., close).
length (int): The length for the SMA and difference calculation.
smoothing (simple int): The length for the EMA smoothing.
Returns: The Lorentzian Trend series.
mlTrendControl(src, length)
Calculates the ML Trend Control value.
Parameters:
src (float): The source series (e.g., close).
length (int): The length for the SMA and standard deviation.
Returns: The ML Trend Control value (0 to 1).
Thư viện Pine
Theo tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này dưới dạng thư viện nguồn mở để các lập trình viên Pine khác trong cộng đồng của chúng tôi có thể sử dụng lại. Xin tri ân tác giả! Bạn có thể sử dụng thư viện này riêng tư hoặc trong các bài đăng nguồn mở khác. Tuy nhiên, bạn cần sử dụng lại mã này theo Nội quy chung.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Thư viện Pine
Theo tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này dưới dạng thư viện nguồn mở để các lập trình viên Pine khác trong cộng đồng của chúng tôi có thể sử dụng lại. Xin tri ân tác giả! Bạn có thể sử dụng thư viện này riêng tư hoặc trong các bài đăng nguồn mở khác. Tuy nhiên, bạn cần sử dụng lại mã này theo Nội quy chung.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.