PINE LIBRARY
Mis à jour

OhMyHtfLibrary

198
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).
Notes de version
v2

Added:
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)
Notes de version
v3

Added:
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.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.