已更新

ReadableTimeframeAlerts

835

More exclusive indicators from AfnanTAjuddin

Subscribe to Supply & Demand Price Action Toolkit for $8.49/month to get exclusive indicators by this author. You pay right on TradingView and can use them on your charts straight away.

Explore Supply & Demand Price Action Toolkit
Fixes the "what timeframe is this?" problem.

Pine's timeframe.period gives you raw values like "60", "240", "1D", "3M" — accurate, but not something a normal user can read at a glance. If your alert says "Zone formed on 360," most people have no idea that 360 means the 6-hour timeframe.

This library converts that raw string into a proper readable label: "60" becomes "1 Hour", "240" becomes "4 Hours", "1D" becomes "Daily", "3M" becomes "3 Months", and so on — covering minutes, hours, days, weeks, months, seconds, and ticks.

I built this after running into the exact issue in my own — a user kept seeing numbers like 360 in their alerts and couldn't tell what timeframe it referred to. This library is what fixed it, and I'm sharing it so anyone facing the same confusion can drop it into their own script.

Usage:
import AfnanTAjuddin/ReadableTimeframeAlerts/1 as tf
alert("Zone formed on " + tf.f_tf_label(timeframe.period))

One line, and your alert messages, labels, or tables show a timeframe users actually understand instead of a raw number.

Found an edge case it doesn't handle correctly? Drop a comment and I'll take a look.
發行說明
v2

Updated:
f_tf_label(tf)
  Converts a TradingView timeframe string into a readable label.
  Parameters:
    tf (simple string): Timeframe string such as "60", "240", "D", "1D", "3M", etc.

Library Updated
Fixed an issue where D, W, and M could show as NaN Days/Weeks/Months.
The library now supports both timeframe.period and input.timeframe values, including D/1D, W/1W, and M/1M, with clean, readable timeframe labels.
發行說明
v3
Library Updated 🚀

Now supports both timeframe.period and input.timeframe() values, including Chart, D/1D, W/1W, and M/1M.

Fixed the NaN timeframe issue and improved Chart handling — when Chart is selected, it now shows the actual chart timeframe in a readable format.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。