PINE LIBRARY
Cập nhật DirectionCalculations

Library "DirectionCalculations"
Direction calculation algorithms for body, bar, and breakout directions
get_body_direction()
Calculate body direction based on open vs close
Returns: Body direction: 1 (bullish), -1 (bearish), 0 (doji)
get_bar_direction()
Calculate bar direction based on close position relative to hl2
Returns: Bar direction: 1 (upper half), -1 (lower half), 0 (middle)
get_breakout_direction()
Calculate breakout direction with outside/inside bar logic
Returns: [breakout_direction, is_outside_bar, is_inside_bar, outside_dir, inside_dir]
get_combined_direction(bod_dir, bar_dir, bro_dir, bro_ob_dir)
Calculate combined direction from body and bar directions
Parameters:
bod_dir (int): Body direction
bar_dir (int): Bar direction
bro_dir (int): Breakout direction
bro_ob_dir (int): Outside bar direction
Returns: Combined direction
is_consecutive_direction(current_dir, previous_dir)
Check if directions are consecutive (no reversal)
Parameters:
current_dir (int): Current direction
previous_dir (int): Previous direction
Returns: True if consecutive (no reversal from +1 to -1 or -1 to +1)
get_all_directions()
Get all direction calculations at once
Returns: [body_dir, bar_dir, breakout_dir, is_outside_bar, is_inside_bar, outside_dir, inside_dir, combined_dir]
get_breakout_distances()
Get distance calculations for breakout analysis
Returns: [HtoH_dist, LtoL_dist] High-to-high and low-to-low distances
get_bar_patterns()
Check for specific bar patterns
Returns: [is_higher_high, is_higher_low, is_lower_low, is_lower_high]
Direction calculation algorithms for body, bar, and breakout directions
get_body_direction()
Calculate body direction based on open vs close
Returns: Body direction: 1 (bullish), -1 (bearish), 0 (doji)
get_bar_direction()
Calculate bar direction based on close position relative to hl2
Returns: Bar direction: 1 (upper half), -1 (lower half), 0 (middle)
get_breakout_direction()
Calculate breakout direction with outside/inside bar logic
Returns: [breakout_direction, is_outside_bar, is_inside_bar, outside_dir, inside_dir]
get_combined_direction(bod_dir, bar_dir, bro_dir, bro_ob_dir)
Calculate combined direction from body and bar directions
Parameters:
bod_dir (int): Body direction
bar_dir (int): Bar direction
bro_dir (int): Breakout direction
bro_ob_dir (int): Outside bar direction
Returns: Combined direction
is_consecutive_direction(current_dir, previous_dir)
Check if directions are consecutive (no reversal)
Parameters:
current_dir (int): Current direction
previous_dir (int): Previous direction
Returns: True if consecutive (no reversal from +1 to -1 or -1 to +1)
get_all_directions()
Get all direction calculations at once
Returns: [body_dir, bar_dir, breakout_dir, is_outside_bar, is_inside_bar, outside_dir, inside_dir, combined_dir]
get_breakout_distances()
Get distance calculations for breakout analysis
Returns: [HtoH_dist, LtoL_dist] High-to-high and low-to-low distances
get_bar_patterns()
Check for specific bar patterns
Returns: [is_higher_high, is_higher_low, is_lower_low, is_lower_high]
Phát hành các Ghi chú
v2Thư viện Pine
Theo đúng tinh thần TradingView, tác giả đã công bố mã Pine này như một thư viện mã nguồn mở để các lập trình viên Pine khác trong cộng đồng có thể tái sử dụng. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này cho mục đích cá nhân hoặc trong các ấn phẩm mã nguồn mở khác, nhưng việc tái sử dụng mã này trong các ấn phẩm phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Thư viện Pine
Theo đúng tinh thần TradingView, tác giả đã công bố mã Pine này như một thư viện mã nguồn mở để các lập trình viên Pine khác trong cộng đồng có thể tái sử dụng. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này cho mục đích cá nhân hoặc trong các ấn phẩm mã nguồn mở khác, nhưng việc tái sử dụng mã này trong các ấn phẩm phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.