PINE LIBRARY
업데이트됨

ATR by Session Library [1CG]

267
Library "ATRxSession"
This library shows you how big the bars usually are during a trading session. It looks only at the times you choose (like New York or London hours), measures the “true range” of every bar in that session, then finds the average for that session. It keeps the last N sessions and gives you their overall average, so you can quickly see how much the market typically moves per bar during your chosen session.

Call getSessionAtr(timezone, session, sessionCount) from your script, and it will return a single number: the average per-bar volatility during the chosen session, based on the last N completed sessions. This makes it easy to plug session-specific volatility into your own indicators or strategies.

getSessionAtr(_timezone, _session, _sessionCount)
  getSessionAtr - Computes a session-aware ATR over completed sessions.
  Parameters:
    _timezone (string): (string) - Timezone string to evaluate session timing.
    _session (string): (string) - Session time range string (e.g., "0930-1600").
    _sessionCount (int): (int) - Number of past completed sessions to include in the rolling average.
  Returns: (float) - The average ATR across the last N completed sessions, or na if not enough data.
릴리즈 노트
v2

Updated: Calculations now use Wilder's Smoothing.
getSessionAtr(_timezone, _session, _sessionCount, _atrLength)
  getSessionAtr - Computes a session-aware ATR over completed sessions.
  Parameters:
    _timezone (string): (string) - Timezone string to evaluate session timing.
    _session (string): (string) - Session time range string (e.g., "0930-1600").
    _sessionCount (int): (int) - Number of past completed sessions to include in the rolling average.
    _atrLength (int): (int) - Wilder ATR smoothing length applied to in-session bars (defaults to 14).
  Returns: (float) - The average ATR across the last N completed sessions, or na if not enough data.
릴리즈 노트
v3

Updated:
getSessionAtr(_timezone, _session, _sessionCount)
  getSessionAtr - Computes a session-aware ATR over completed sessions.
  Parameters:
    _timezone (string): (string) - Timezone string to evaluate session timing.
    _session (string): (string) - Session time range string (e.g., "0930-1600").
    _sessionCount (simple int): (int) - Number of past completed sessions to include in the rolling average and ATR smoothing.
  Returns: (float) - The session ATR, with automatic fallback to standard ATR when needed.

  • Simplified API: getSessionAtr(_timezone, _session, _sessionCount) only; removed ATR length and timeframe parameters.
  • Session ATR smoothing now uses _sessionCount exclusively (also used for fallback length).
  • Built‑in fallback: when the session fits inside a single bar or session ATR is invalid, it returns standard ta.atr(_sessionCount).
릴리즈 노트
v4

Added:
sessionAtrFromConfig(_config)
  sessionAtrFromConfig - Session ATR using the library-owned config UDT.
  Parameters:
    _config (SessionAtrConfig): (SessionAtrConfig) - Consumer-facing session ATR config.
  Returns: (float) - Session ATR with fallback handling.

SessionAtrConfig
  SessionAtrConfig Consumer-facing inputs for session-scoped ATR.
  Fields:
    timezone (series string): IANA timezone used for session timing.
    session (series string): TradingView session string.
    sessionCount (series int): Number of completed sessions to average.

Updated:
getSessionAtr(_timezone, _session, _sessionCount)
  getSessionAtr - Computes a session-aware ATR over completed sessions.
  Parameters:
    _timezone (string): (string) - Timezone string to evaluate session timing.
    _session (string): (string) - Session time range string (e.g., "0930-1600").
    _sessionCount (int): (int) - Number of past completed sessions to include in the rolling average and ATR smoothing.
  Returns: (float) - The session ATR, with automatic fallback to standard ATR when needed.

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.