OPEN-SOURCE SCRIPT
Daily 5-SMA (intraday)

Daily 5-SMA Equivalent
This indicator translates a daily Simple Moving Average into its mathematically equivalent period for any intraday (or higher) timeframe, so the line you see on a 5-minute chart represents the same lookback window as the daily SMA on a daily chart — no manual period recalculation needed.
How it works
The script measures how many bars of the current timeframe fit inside the total minute-span of the reference SMA. For example, a 5-day SMA covers 1,950 minutes on a stock market (5 × 390 min/day). On a 5-minute chart that becomes a 390-period SMA; on a 15-minute chart it becomes a 130-period SMA. The conversion is automatic whenever you change timeframes.
An information table in the top-right corner always shows the active timeframe, the calculated equivalent period, the reference setting, and the selected market type — so you can verify the math at a glance.
Inputs
Source — Price field used for the calculation (default: close).
Reference Days — The number of daily bars the SMA spans. Default is 5 (the classic daily 5-SMA). Accepts 1–50.
Market Type — Determines how many minutes constitute a trading day:
24h — 1,440 min/day, for Forex and Crypto markets.
Stock — 390 min/day (6.5-hour session), for equities and equity futures.
Timeframe support
The period conversion handles seconds, minutes, hours, days, weeks, and monthly timeframes. On daily or higher timeframes the indicator still plots correctly, though it is most useful on intraday charts.
Alerts
Four alert conditions are included:
Price crosses above the SMA equivalent
Price crosses below the SMA equivalent
SMA is rising
SMA is falling
Usage notes
Set Market Type to Stock for equities and NQ/ES/MES futures. Use 24h for Bitcoin, Ethereum, Forex pairs, or any continuously traded instrument. The displayed equivalent period will always be at least 1, regardless of how high a timeframe you are viewing.
This indicator translates a daily Simple Moving Average into its mathematically equivalent period for any intraday (or higher) timeframe, so the line you see on a 5-minute chart represents the same lookback window as the daily SMA on a daily chart — no manual period recalculation needed.
How it works
The script measures how many bars of the current timeframe fit inside the total minute-span of the reference SMA. For example, a 5-day SMA covers 1,950 minutes on a stock market (5 × 390 min/day). On a 5-minute chart that becomes a 390-period SMA; on a 15-minute chart it becomes a 130-period SMA. The conversion is automatic whenever you change timeframes.
An information table in the top-right corner always shows the active timeframe, the calculated equivalent period, the reference setting, and the selected market type — so you can verify the math at a glance.
Inputs
Source — Price field used for the calculation (default: close).
Reference Days — The number of daily bars the SMA spans. Default is 5 (the classic daily 5-SMA). Accepts 1–50.
Market Type — Determines how many minutes constitute a trading day:
24h — 1,440 min/day, for Forex and Crypto markets.
Stock — 390 min/day (6.5-hour session), for equities and equity futures.
Timeframe support
The period conversion handles seconds, minutes, hours, days, weeks, and monthly timeframes. On daily or higher timeframes the indicator still plots correctly, though it is most useful on intraday charts.
Alerts
Four alert conditions are included:
Price crosses above the SMA equivalent
Price crosses below the SMA equivalent
SMA is rising
SMA is falling
Usage notes
Set Market Type to Stock for equities and NQ/ES/MES futures. Use 24h for Bitcoin, Ethereum, Forex pairs, or any continuously traded instrument. The displayed equivalent period will always be at least 1, regardless of how high a timeframe you are viewing.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。