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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.