PINE LIBRARY
Cập nhật ZScoreAnalysis

Library "ZScoreAnalysis"
Z-score analysis for detecting statistical deviations and excess market behavior
calculate_zscore(source, lookback, threshold, switch_enabled)
Calculate Z-score and related metrics with history tracking
Parameters:
source (float): Data source for Z-score calculation
lookback (int): Lookback period for mean and standard deviation
threshold (float): Z-score threshold for significance
switch_enabled (string): Enable/disable switch ("Enabled"/"Disabled")
Returns: [z_score, z_hist, z_avg] Z-score, historical significant values, and running average
get_zscore_threshold(opt, input_thr, avg)
Get threshold based on threshold option
Parameters:
opt (string): Threshold option ("User Input Threshold", "Average as Threshold", or other)
input_thr (float): User input threshold
avg (float): Average threshold
Returns: Calculated threshold value
is_zscore_filtered(switch_enabled, zscore, threshold)
Check if a metric passes the Z-score filter
Parameters:
switch_enabled (string): Enable/disable switch
zscore (float): Current Z-score value
threshold (float): Z-score threshold
Returns: True if filtered (exceeds threshold)
get_consecutive_distances(body_dir, breakout_dir, is_inside_bar)
Calculate consecutive distances for Z-score analysis
Parameters:
body_dir (int): Body direction
breakout_dir (int): Breakout direction
is_inside_bar (bool): Inside bar flag
Returns: [consecutive_close_dist, consecutive_hl_dist]
get_trend_to_mean_distance()
Calculate distance from trend to mean for momentum analysis
Returns: Distance between trend and mean
get_all_zscores(lookback, threshold, bar_dist_switch, body_dist_switch, chl_dist_switch, cc_dist_switch, m_dist_switch, body_dir, breakout_dir, is_inside_bar)
Get all Z-score calculations for the indicator
Parameters:
lookback (int): Z-score lookback period
threshold (float): Z-score threshold
bar_dist_switch (string): Enable bar distance Z-score
body_dist_switch (string): Enable body distance Z-score
chl_dist_switch (string): Enable consecutive highs/lows Z-score
cc_dist_switch (string): Enable consecutive closes Z-score
m_dist_switch (string): Enable momentum distance Z-score
body_dir (int): Body direction
breakout_dir (int): Breakout direction
is_inside_bar (bool): Inside bar flag
Returns: [z_results] Array of Z-score results and filters
get_combined_zscore_filters(z_filters)
Get combined Z-score filters
Parameters:
z_filters (map<string, bool>): Map of individual Z-score filters
Returns: [combined_filters] Various combinations of Z-score filters
get_basic_distances()
Calculate basic distances used in Z-score analysis
Returns: [bar_dist, body_dist] Bar range and body range
get_individual_zscore_filter(z_filters, filter_name)
Get individual Z-score filter by name
Parameters:
z_filters (map<string, bool>): Map of Z-score filters
filter_name (string): Name of the filter ("bar_dist", "body_dist", etc.)
Returns: Boolean filter result
has_any_zscore_signal(z_filters)
Check if any Z-score filter is active
Parameters:
z_filters (map<string, bool>): Map of individual Z-score filters
Returns: True if any Z-score exceeds threshold
Z-score analysis for detecting statistical deviations and excess market behavior
calculate_zscore(source, lookback, threshold, switch_enabled)
Calculate Z-score and related metrics with history tracking
Parameters:
source (float): Data source for Z-score calculation
lookback (int): Lookback period for mean and standard deviation
threshold (float): Z-score threshold for significance
switch_enabled (string): Enable/disable switch ("Enabled"/"Disabled")
Returns: [z_score, z_hist, z_avg] Z-score, historical significant values, and running average
get_zscore_threshold(opt, input_thr, avg)
Get threshold based on threshold option
Parameters:
opt (string): Threshold option ("User Input Threshold", "Average as Threshold", or other)
input_thr (float): User input threshold
avg (float): Average threshold
Returns: Calculated threshold value
is_zscore_filtered(switch_enabled, zscore, threshold)
Check if a metric passes the Z-score filter
Parameters:
switch_enabled (string): Enable/disable switch
zscore (float): Current Z-score value
threshold (float): Z-score threshold
Returns: True if filtered (exceeds threshold)
get_consecutive_distances(body_dir, breakout_dir, is_inside_bar)
Calculate consecutive distances for Z-score analysis
Parameters:
body_dir (int): Body direction
breakout_dir (int): Breakout direction
is_inside_bar (bool): Inside bar flag
Returns: [consecutive_close_dist, consecutive_hl_dist]
get_trend_to_mean_distance()
Calculate distance from trend to mean for momentum analysis
Returns: Distance between trend and mean
get_all_zscores(lookback, threshold, bar_dist_switch, body_dist_switch, chl_dist_switch, cc_dist_switch, m_dist_switch, body_dir, breakout_dir, is_inside_bar)
Get all Z-score calculations for the indicator
Parameters:
lookback (int): Z-score lookback period
threshold (float): Z-score threshold
bar_dist_switch (string): Enable bar distance Z-score
body_dist_switch (string): Enable body distance Z-score
chl_dist_switch (string): Enable consecutive highs/lows Z-score
cc_dist_switch (string): Enable consecutive closes Z-score
m_dist_switch (string): Enable momentum distance Z-score
body_dir (int): Body direction
breakout_dir (int): Breakout direction
is_inside_bar (bool): Inside bar flag
Returns: [z_results] Array of Z-score results and filters
get_combined_zscore_filters(z_filters)
Get combined Z-score filters
Parameters:
z_filters (map<string, bool>): Map of individual Z-score filters
Returns: [combined_filters] Various combinations of Z-score filters
get_basic_distances()
Calculate basic distances used in Z-score analysis
Returns: [bar_dist, body_dist] Bar range and body range
get_individual_zscore_filter(z_filters, filter_name)
Get individual Z-score filter by name
Parameters:
z_filters (map<string, bool>): Map of Z-score filters
filter_name (string): Name of the filter ("bar_dist", "body_dist", etc.)
Returns: Boolean filter result
has_any_zscore_signal(z_filters)
Check if any Z-score filter is active
Parameters:
z_filters (map<string, bool>): Map of individual Z-score filters
Returns: True if any Z-score exceeds threshold
Phát hành các Ghi chú
v2Phát hành các Ghi chú
v3Thư 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.