PINE LIBRARY
Cập nhật OhMyHtfLibrary

Library "OhMyHtfLibrary"
HTF candle platform: timeframe alignment, profiles, and (future) packed OHLC / draw helpers. Import as `import daggerok/OhMyHtfLibrary/1 as omhl`. Sweep/OB domain → future `OhMyHtfSweepLibrary` (`omhsl`).
resolveHtfContext(chart_tf_seconds, default_htf, default_candle_count, align_ctf_max_seconds, align_htf, align_enabled, profile_ctf_exact_seconds, profile_htf, profile_enabled, profile_candle_counts)
Resolves HTF string, enable flag, and candle count from Timeframes Alignment + Profiles.
TFA: first alignment row where `chart_tf_seconds <= align_ctf_max_seconds` wins.
Profiles: first enabled row where `chart_tf_seconds == profile_ctf_exact_seconds` overrides TFA.
Parameters:
chart_tf_seconds (int): Chart timeframe in seconds.
default_htf (string): Fallback HTF when no alignment rule matches.
default_candle_count (int): Default HTF candle count (HTF Candles input).
align_ctf_max_seconds (array<int>): Upper-bound CTF seconds per TFA row (length 14).
align_htf (array<string>): HTF string per TFA row.
align_enabled (array<bool>): Enabled flag per TFA row.
profile_ctf_exact_seconds (array<int>): Exact chart TF seconds per profile row (length 12).
profile_htf (array<string>): HTF string per profile row.
profile_enabled (array<bool>): Profile row enabled flags.
profile_candle_counts (array<int>): Candle count per profile row.
Returns: `HtfContext` with resolved settings.
HtfContext
Resolved HTF timeframe settings for the current chart.
Fields:
htf (series string): Higher timeframe string for `request.security` and draw logic.
is_enabled (series bool): Whether HTF features are active for this chart TF (TFA enable flag or profile override).
candle_count (series int): Number of HTF candles to display (profile may override default).
profile_override (series bool): True when a profile row matched (exact CTF).
HTF candle platform: timeframe alignment, profiles, and (future) packed OHLC / draw helpers. Import as `import daggerok/OhMyHtfLibrary/1 as omhl`. Sweep/OB domain → future `OhMyHtfSweepLibrary` (`omhsl`).
resolveHtfContext(chart_tf_seconds, default_htf, default_candle_count, align_ctf_max_seconds, align_htf, align_enabled, profile_ctf_exact_seconds, profile_htf, profile_enabled, profile_candle_counts)
Resolves HTF string, enable flag, and candle count from Timeframes Alignment + Profiles.
TFA: first alignment row where `chart_tf_seconds <= align_ctf_max_seconds` wins.
Profiles: first enabled row where `chart_tf_seconds == profile_ctf_exact_seconds` overrides TFA.
Parameters:
chart_tf_seconds (int): Chart timeframe in seconds.
default_htf (string): Fallback HTF when no alignment rule matches.
default_candle_count (int): Default HTF candle count (HTF Candles input).
align_ctf_max_seconds (array<int>): Upper-bound CTF seconds per TFA row (length 14).
align_htf (array<string>): HTF string per TFA row.
align_enabled (array<bool>): Enabled flag per TFA row.
profile_ctf_exact_seconds (array<int>): Exact chart TF seconds per profile row (length 12).
profile_htf (array<string>): HTF string per profile row.
profile_enabled (array<bool>): Profile row enabled flags.
profile_candle_counts (array<int>): Candle count per profile row.
Returns: `HtfContext` with resolved settings.
HtfContext
Resolved HTF timeframe settings for the current chart.
Fields:
htf (series string): Higher timeframe string for `request.security` and draw logic.
is_enabled (series bool): Whether HTF features are active for this chart TF (TFA enable flag or profile override).
candle_count (series int): Number of HTF candles to display (profile may override default).
profile_override (series bool): True when a profile row matched (exact CTF).
Phát hành các Ghi chú
v2Added:
chartOpenPack()
Packed HTF opens for `request.security(sym, htf, …, lookahead_on)` — slots h7…h0.
Returns: `array<float>` length 8; evaluate on HTF via security expression only.
chartHighPack()
Packed HTF highs — slots h7…h0.
chartLowPack()
Packed HTF lows — slots h7…h0.
chartClosePack()
Packed HTF closes — slots h7…h0.
chartTimePack()
Packed HTF bar open times — slots h7…h0.
smtDataPack()
Packed comparison-symbol HTF data for SMT — h7…h0, l7…l0, t1, t0 (18 floats).
htfDataReady(chart_times)
Whether chart `request.security` time pack has enough data for HTF draw (early replay guard).
Parameters:
chart_times (array<int>): `chartTimePack()` result from security.
Returns: `true` when size ≥ 8 and forming + prior slot times are non-na.
htfFormingBarTime(chart_times)
Open time of the forming HTF candle (pack slot 7).
Parameters:
chart_times (array<int>)
htfPeriodMs(chart_times)
HTF period length in ms from forming vs prior slot open times.
Parameters:
chart_times (array<int>)
htfStartIndex(candle_count)
First pack index to draw for `candle_count` visible HTF candles.
Parameters:
candle_count (int)
formingHtfChartBarIndex(forming_bar_time)
Chart bar_index when the forming HTF period started (for last-open line anchor).
Call every bar from indicator scope with `htfFormingBarTime(chart_times)`.
Parameters:
forming_bar_time (int)
Phát hành các Ghi chú
v3Added:
fun(x)
TODO: add function description here
Parameters:
x (float): TODO: add parameter x description here
Returns: TODO: add what function returns
Removed:
resolveHtfContext(chart_tf_seconds, default_htf, default_candle_count, align_ctf_max_seconds, align_htf, align_enabled, profile_ctf_exact_seconds, profile_htf, profile_enabled, profile_candle_counts)
Resolves HTF string, enable flag, and candle count from Timeframes Alignment + Profiles.
TFA: first alignment row where `chart_tf_seconds <= align_ctf_max_seconds` wins.
Profiles: first enabled row where `chart_tf_seconds == profile_ctf_exact_seconds` overrides TFA.
chartOpenPack()
Packed HTF opens for `request.security(sym, htf, …, lookahead_on)` — slots h7…h0.
chartHighPack()
Packed HTF highs — slots h7…h0.
chartLowPack()
Packed HTF lows — slots h7…h0.
chartClosePack()
Packed HTF closes — slots h7…h0.
chartTimePack()
Packed HTF bar open times — slots h7…h0.
smtDataPack()
Packed comparison-symbol HTF data for SMT — h7…h0, l7…l0, t1, t0 (18 floats).
htfDataReady(chart_times)
Whether chart `request.security` time pack has enough data for HTF draw (early replay guard).
htfFormingBarTime(chart_times)
Open time of the forming HTF candle (pack slot 7).
htfPeriodMs(chart_times)
HTF period length in ms from forming vs prior slot open times.
htfStartIndex(candle_count)
First pack index to draw for `candle_count` visible HTF candles.
formingHtfChartBarIndex(forming_bar_time)
Chart bar_index when the forming HTF period started (for last-open line anchor).
Call every bar from indicator scope with `htfFormingBarTime(chart_times)`.
HtfContext
Resolved HTF timeframe settings for the current chart.
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.
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.