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.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.