OPEN-SOURCE SCRIPT
MTF MA System by ogudora

# MTF MA System by ogudora
A multi-timeframe moving average indicator designed for traders who need to read multiple MAs at a glance without losing track of which line belongs to which timeframe.
## What it does
Plots short, mid, and long-term moving averages from up to four timeframes simultaneously: the current chart timeframe, 1H, 4H, and Daily. Each line is identified by three independent visual dimensions:
- **Color** indicates the period (short / mid / long)
- **ATR-based halo width** indicates the timeframe (higher TF = wider halo)
- **Line style and thickness** add another layer of timeframe distinction
This three-axis encoding eliminates the common problem of MTF MA indicators where users lose track of which line is which.
## Key features
**RTH-only calculation by default.** Upper timeframe MAs are calculated using Regular Trading Hours data only, independent of the chart's Extended Hours setting. This ensures that the same MA value appears regardless of which timeframe chart you are viewing. ETH-inclusive mode is available as a toggle.
**ATR-based halo bands.** Instead of a single thin line, each MA is drawn with a translucent halo whose width scales with current ATR. Higher timeframes get wider halos, so a daily MA visually feels like a zone, while a 1H MA reads as a precise line.
**Per-timeframe line thickness and style.** Each TF group has independent settings for line thickness (1 to 4) and style (plain / stepline / stepline with diamonds). The default uses a diamond stepline for 4H to give it a distinctive "ladder" appearance.
**Keep-out labels.** Optional labels along each MA line at regular intervals, useful for marking visual zones across the chart.
**Auto TF filtering.** Lower timeframe MAs are automatically hidden when you switch to a higher chart TF, preventing visual clutter on long-term charts.
## Default configuration
- **MA type:** EMA, periods 20 / 50 / 200
- **Timeframes:** 1H, 4H, Daily (current chart TF off by default)
- **Session:** RTH only
- **Colors:** magenta (short) / green (mid) / purple (long)
- **Halo widths:** 1H = 0.1×ATR, 4H = 0.1×ATR, Daily = 0.4×ATR
- **Line thickness:** 1H = 3, 4H = 1, Daily = 3
- **4H line style:** stepline with diamonds
These defaults are tuned for U.S. equities and Japanese equities on intraday-to-swing timeframes. All values are user-configurable.
## Notes on session handling
For U.S. stocks, the 4H EMA200 calculated from RTH data and from ETH-inclusive data can differ by 10–15% during volatile periods. The default RTH mode aligns with how most institutional desks read moving averages. If you trade extended-hours moves and prefer ETH-inclusive calculation, toggle the session setting in the indicator inputs.
## Compatible markets
Designed and tested on U.S. equities (NASDAQ, NYSE) and Japanese equities. Should work on any symbol where the underlying exchange has a defined Regular Trading Hours session.
## Why I built this
After years of running MTF MA indicators that became unreadable once more than four or five lines were on screen, I wanted a system that uses encoding redundancy — color, halo width, and line style — so that any single line could be identified without reading its legend. This indicator is the result of that iteration.
Feedback and suggestions are welcome.
A multi-timeframe moving average indicator designed for traders who need to read multiple MAs at a glance without losing track of which line belongs to which timeframe.
## What it does
Plots short, mid, and long-term moving averages from up to four timeframes simultaneously: the current chart timeframe, 1H, 4H, and Daily. Each line is identified by three independent visual dimensions:
- **Color** indicates the period (short / mid / long)
- **ATR-based halo width** indicates the timeframe (higher TF = wider halo)
- **Line style and thickness** add another layer of timeframe distinction
This three-axis encoding eliminates the common problem of MTF MA indicators where users lose track of which line is which.
## Key features
**RTH-only calculation by default.** Upper timeframe MAs are calculated using Regular Trading Hours data only, independent of the chart's Extended Hours setting. This ensures that the same MA value appears regardless of which timeframe chart you are viewing. ETH-inclusive mode is available as a toggle.
**ATR-based halo bands.** Instead of a single thin line, each MA is drawn with a translucent halo whose width scales with current ATR. Higher timeframes get wider halos, so a daily MA visually feels like a zone, while a 1H MA reads as a precise line.
**Per-timeframe line thickness and style.** Each TF group has independent settings for line thickness (1 to 4) and style (plain / stepline / stepline with diamonds). The default uses a diamond stepline for 4H to give it a distinctive "ladder" appearance.
**Keep-out labels.** Optional labels along each MA line at regular intervals, useful for marking visual zones across the chart.
**Auto TF filtering.** Lower timeframe MAs are automatically hidden when you switch to a higher chart TF, preventing visual clutter on long-term charts.
## Default configuration
- **MA type:** EMA, periods 20 / 50 / 200
- **Timeframes:** 1H, 4H, Daily (current chart TF off by default)
- **Session:** RTH only
- **Colors:** magenta (short) / green (mid) / purple (long)
- **Halo widths:** 1H = 0.1×ATR, 4H = 0.1×ATR, Daily = 0.4×ATR
- **Line thickness:** 1H = 3, 4H = 1, Daily = 3
- **4H line style:** stepline with diamonds
These defaults are tuned for U.S. equities and Japanese equities on intraday-to-swing timeframes. All values are user-configurable.
## Notes on session handling
For U.S. stocks, the 4H EMA200 calculated from RTH data and from ETH-inclusive data can differ by 10–15% during volatile periods. The default RTH mode aligns with how most institutional desks read moving averages. If you trade extended-hours moves and prefer ETH-inclusive calculation, toggle the session setting in the indicator inputs.
## Compatible markets
Designed and tested on U.S. equities (NASDAQ, NYSE) and Japanese equities. Should work on any symbol where the underlying exchange has a defined Regular Trading Hours session.
## Why I built this
After years of running MTF MA indicators that became unreadable once more than four or five lines were on screen, I wanted a system that uses encoding redundancy — color, halo width, and line style — so that any single line could be identified without reading its legend. This indicator is the result of that iteration.
Feedback and suggestions are welcome.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.