OPEN-SOURCE SCRIPT
MTF 20 SMA Table - DXY

**MTF 20 SMA Table - Multi-Timeframe Trend Analysis Dashboard**
**Overview:**
This indicator provides a comprehensive multi-timeframe analysis dashboard that displays the relationship between price and the 20-period Simple Moving Average (SMA) across four key timeframes: 15-minute, 1-hour, 4-hour, and Daily. It's designed to help traders quickly identify trend alignment and potential trading opportunities across multiple timeframes at a glance. It's definitely not perfect but has helped me speed up my backtesting efforts as it's worked well for me eliminating flipping back and forth between timeframes excpet when I have confluence on the table, then I check the HTF.
**How It Works:**
The indicator creates a table overlay on your chart showing three critical metrics for each timeframe:
1. **Price vs SMA (Row 1):** Shows whether price is currently above (bullish) or below (bearish) the 20 SMA
- Green = Price Above SMA
- Red = Price Below SMA
2. **SMA Direction (Row 2):** Indicates the trend direction of the SMA itself over a lookback period
- Green (↗ Rising) = Uptrend
- Red (↘ Falling) = Downtrend
- Gray (→ Flat) = Ranging/Consolidation
3. **Strength (Row 3):** Displays the distance between current price and the SMA in pips
- Purple background = Strong move (>50 pips away)
- Orange background = Moderate move (20-50 pips)
- Gray background = Weak/consolidating (<20 pips)
- Text color: Green for positive distance, Red for negative
**Key Features:**
- **Customizable Table Position:** Place the table anywhere on your chart (9 position options)
- **Adjustable SMA Lengths:** Modify the SMA period for each timeframe independently (default: 20)
- **Direction Lookback Settings:** Fine-tune how far back the indicator looks to determine SMA direction for each timeframe
- **Flat Threshold:** Set the pip threshold for determining when an SMA is "flat" vs trending (default: 5 pips)
- **DXY Optimized:** Calculations are calibrated for the US Dollar Index (1 pip = 0.01)
**Best Use Cases:**
1. **Trend Alignment:** Identify when multiple timeframes align in the same direction for higher probability trades
2. **Divergence Spotting:** Detect when lower timeframes diverge from higher timeframes (potential reversals)
3. **Entry Timing:** Use lower timeframe signals while higher timeframes confirm overall trend
4. **Strength Assessment:** Gauge how extended price is from the mean (SMA) to avoid overextended entries
**Settings Guide:**
- **SMA Settings Group:** Adjust the SMA period for each timeframe (15M, 1H, 4H, Daily)
- **SMA Direction Group:** Control lookback periods to determine trend direction
- 15M: Default 5 candles
- 1H: Default 10 candles
- 4H: Default 15 candles
- Daily: Default 20 candles
- **Flat Threshold:** Set sensitivity for "flat" detection (lower = more sensitive to ranging markets)
**Trading Strategy Examples:**
1. **Trend Following:** Look for all timeframes showing the same direction (all green or all red)
2. **Pullback Trading:** When Daily/4H are green but 15M/1H show red, wait for lower timeframes to flip green for entry
3. **Ranging Markets:** When multiple SMAs show "flat", consider range-bound strategies
**Important Notes:**
- This is a reference tool only, not a standalone trading system
- Always use proper risk management and combine with other analysis methods
- Best suited for trending instruments like indices and major forex pairs
- Calculations are optimized for DXY but can be used on other instruments (pip calculations may need adjustment)
**Credits:**
Feel free to modify and improve this code! Suggestions for enhancements are welcome in the comments.
---
**Installation Instructions:**
1. Add the indicator to your TradingView chart
2. Adjust the table position via settings to avoid overlap with price action
3. Customize SMA lengths and lookback periods to match your trading style
4. Monitor the table for timeframe alignment and trend confirmation
---
This indicator is published as open source for the community to learn from and improve upon. Happy trading! 📈
**Overview:**
This indicator provides a comprehensive multi-timeframe analysis dashboard that displays the relationship between price and the 20-period Simple Moving Average (SMA) across four key timeframes: 15-minute, 1-hour, 4-hour, and Daily. It's designed to help traders quickly identify trend alignment and potential trading opportunities across multiple timeframes at a glance. It's definitely not perfect but has helped me speed up my backtesting efforts as it's worked well for me eliminating flipping back and forth between timeframes excpet when I have confluence on the table, then I check the HTF.
**How It Works:**
The indicator creates a table overlay on your chart showing three critical metrics for each timeframe:
1. **Price vs SMA (Row 1):** Shows whether price is currently above (bullish) or below (bearish) the 20 SMA
- Green = Price Above SMA
- Red = Price Below SMA
2. **SMA Direction (Row 2):** Indicates the trend direction of the SMA itself over a lookback period
- Green (↗ Rising) = Uptrend
- Red (↘ Falling) = Downtrend
- Gray (→ Flat) = Ranging/Consolidation
3. **Strength (Row 3):** Displays the distance between current price and the SMA in pips
- Purple background = Strong move (>50 pips away)
- Orange background = Moderate move (20-50 pips)
- Gray background = Weak/consolidating (<20 pips)
- Text color: Green for positive distance, Red for negative
**Key Features:**
- **Customizable Table Position:** Place the table anywhere on your chart (9 position options)
- **Adjustable SMA Lengths:** Modify the SMA period for each timeframe independently (default: 20)
- **Direction Lookback Settings:** Fine-tune how far back the indicator looks to determine SMA direction for each timeframe
- **Flat Threshold:** Set the pip threshold for determining when an SMA is "flat" vs trending (default: 5 pips)
- **DXY Optimized:** Calculations are calibrated for the US Dollar Index (1 pip = 0.01)
**Best Use Cases:**
1. **Trend Alignment:** Identify when multiple timeframes align in the same direction for higher probability trades
2. **Divergence Spotting:** Detect when lower timeframes diverge from higher timeframes (potential reversals)
3. **Entry Timing:** Use lower timeframe signals while higher timeframes confirm overall trend
4. **Strength Assessment:** Gauge how extended price is from the mean (SMA) to avoid overextended entries
**Settings Guide:**
- **SMA Settings Group:** Adjust the SMA period for each timeframe (15M, 1H, 4H, Daily)
- **SMA Direction Group:** Control lookback periods to determine trend direction
- 15M: Default 5 candles
- 1H: Default 10 candles
- 4H: Default 15 candles
- Daily: Default 20 candles
- **Flat Threshold:** Set sensitivity for "flat" detection (lower = more sensitive to ranging markets)
**Trading Strategy Examples:**
1. **Trend Following:** Look for all timeframes showing the same direction (all green or all red)
2. **Pullback Trading:** When Daily/4H are green but 15M/1H show red, wait for lower timeframes to flip green for entry
3. **Ranging Markets:** When multiple SMAs show "flat", consider range-bound strategies
**Important Notes:**
- This is a reference tool only, not a standalone trading system
- Always use proper risk management and combine with other analysis methods
- Best suited for trending instruments like indices and major forex pairs
- Calculations are optimized for DXY but can be used on other instruments (pip calculations may need adjustment)
**Credits:**
Feel free to modify and improve this code! Suggestions for enhancements are welcome in the comments.
---
**Installation Instructions:**
1. Add the indicator to your TradingView chart
2. Adjust the table position via settings to avoid overlap with price action
3. Customize SMA lengths and lookback periods to match your trading style
4. Monitor the table for timeframe alignment and trend confirmation
---
This indicator is published as open source for the community to learn from and improve upon. Happy trading! 📈
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.