OPEN-SOURCE SCRIPT
NIL - Dynamic Timeframe EMA

NIL - Dynamic Timeframe EMA (Limited)
This indicator automatically plots higher-timeframe EMAs (1H, 1D, 1W, 1M) on any chart timeframe while keeping your chart clean and professional.
It intelligently calculates the correct EMA length based on the current bar duration and automatically hides any EMA that matches or is lower than the chart's timeframe (no more redundant or flat lines).
Perfect for intraday traders who want to see daily, weekly, and monthly EMA context without manual adjustments.
═
█ OVERVIEW
The script converts standard time-based EMAs into dynamic periods:
• 1-hour EMA
• 1-day EMA
• 1-week EMA
• 1-month EMA
It uses approximate trading minutes (390 min per day, 21 trading days per month) for accurate calculations across all timeframes — from seconds to monthly charts.
Key Smart Feature:
The indicator automatically hides EMAs that are no longer meaningful:
• On 1H or higher → 1H EMA is hidden
• On Daily or higher → 1H + 1D EMAs are hidden
• On Weekly or higher → 1H + 1D + 1W EMAs are hidden
• On Monthly → only 1M EMA remains (if enabled)
This prevents visual clutter and keeps the chart focused.
═
█ FEATURES
═
█ HOW TO USE
1. Add the indicator to any chart
2. Enable/disable each EMA via the inputs
3. Adjust colors as desired
4. (Optional) Increase "Max EMA Lookback" if working on very low timeframes
The top-right table will always show you:
• Which EMAs are active
• The exact period used for each
• Whether the period was capped
Best Use Cases:
• Intraday trading with higher-timeframe context
• Swing trading on lower timeframes
• Quickly assessing trend alignment across multiple time horizons
═
█ INPUTS
Display
• Show 1H EMA, Show 1D EMA, Show 1W EMA, Show 1M EMA
Colors
• Individual color selection for each EMA line
Limits
• Max EMA Lookback — protects against Pine Script calculation limits (default 5000)
═
█ NOTES & LIMITATIONS
• Calculations are performed on the chart's native data (not using request.security() — faster, no repainting).
• Uses standard trading session approximations (390 minutes/day).
• Very high periods on extremely low timeframes (e.g. 1-second) are automatically capped.
Enjoy cleaner charts with meaningful higher-timeframe EMAs!
Feel free to leave feedback or suggestions for future improvements.
This indicator automatically plots higher-timeframe EMAs (1H, 1D, 1W, 1M) on any chart timeframe while keeping your chart clean and professional.
It intelligently calculates the correct EMA length based on the current bar duration and automatically hides any EMA that matches or is lower than the chart's timeframe (no more redundant or flat lines).
Perfect for intraday traders who want to see daily, weekly, and monthly EMA context without manual adjustments.
═
█ OVERVIEW
The script converts standard time-based EMAs into dynamic periods:
• 1-hour EMA
• 1-day EMA
• 1-week EMA
• 1-month EMA
It uses approximate trading minutes (390 min per day, 21 trading days per month) for accurate calculations across all timeframes — from seconds to monthly charts.
Key Smart Feature:
The indicator automatically hides EMAs that are no longer meaningful:
• On 1H or higher → 1H EMA is hidden
• On Daily or higher → 1H + 1D EMAs are hidden
• On Weekly or higher → 1H + 1D + 1W EMAs are hidden
• On Monthly → only 1M EMA remains (if enabled)
This prevents visual clutter and keeps the chart focused.
═
█ FEATURES
- Fully automatic period calculation based on current timeframe
- Smart show/hide logic — no redundant lines
- Dynamic info table showing actual periods used
- Capping system to respect Pine Script's 5000-bar limit (configurable)
- Clean, customizable colors and display options
- Works on all timeframes (seconds, minutes, daily, weekly, monthly)
═
█ HOW TO USE
1. Add the indicator to any chart
2. Enable/disable each EMA via the inputs
3. Adjust colors as desired
4. (Optional) Increase "Max EMA Lookback" if working on very low timeframes
The top-right table will always show you:
• Which EMAs are active
• The exact period used for each
• Whether the period was capped
Best Use Cases:
• Intraday trading with higher-timeframe context
• Swing trading on lower timeframes
• Quickly assessing trend alignment across multiple time horizons
═
█ INPUTS
Display
• Show 1H EMA, Show 1D EMA, Show 1W EMA, Show 1M EMA
Colors
• Individual color selection for each EMA line
Limits
• Max EMA Lookback — protects against Pine Script calculation limits (default 5000)
═
█ NOTES & LIMITATIONS
• Calculations are performed on the chart's native data (not using request.security() — faster, no repainting).
• Uses standard trading session approximations (390 minutes/day).
• Very high periods on extremely low timeframes (e.g. 1-second) are automatically capped.
Enjoy cleaner charts with meaningful higher-timeframe EMAs!
Feel free to leave feedback or suggestions for future improvements.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。