OPEN-SOURCE SCRIPT
Multiple EMA + SMA (8-in-1, or 4 of each)

This combo indicator takes Tradingview's default SMA and EMA Pinescript code and basically duplicates it 8 times. There are 4 EMAs and 4 SMAs, each configurable to their own timeframe, line, color, etc. I did this so I could see several combinations of moving averages on various chart timeframes, such as:
- Daily chart: 200 SMA, 50 SMA, 20 EMA
- 4 hour chart: 200 SMA, 50 EMA, 20 EMA
- 1 hour chart: 50 EMA, 20 EMA, 9 EMA
- 30 minute chart: 50 EMA, 20 EMA, 9 EMA
Moving Averages Are Filters, Not Triggers: The moving average smooths price action to reveal the dominant market current, not to provide buy or sell signals alone. It filters market noise but requires price action confirmation for entry decisions.Therefore it's important to note the **slope** direction of the MA too.
Matching Time Frame and Holding Period: Using a moving average setting built on a timeframe inconsistent with your trade duration (e.g., a short moving average on a multi-month trade) causes frequent whipsaws. The setting must reflect your trade horizon.
Three Roles of Moving Averages on Any Time Frame:
1. **Tide (Slowest Line)** — Indicates the overall market direction and which side to trade.
2. **Trend (Middle Line)** — Represents the active trend you trade around.
3. **Timing (Fastest Line)** — Identifies pullback zones and potential entry points.
Consistency and Discipline are Crucial: The hardest part of trading is not knowing the settings but patiently waiting for alignment of the tide, trend, and timing lines, and resisting impulsive trades.
When to use EMA or SMA: Shorter time frames use EMAs for faster reaction to price changes, whereas longer time frames use SMAs to smooth out noise and emphasize broader trends. The 200-day SMA is particularly important as it is the most widely followed moving average, creating real support/resistance due to collective market attention.
Examples and Practical Application:
- A trader looking for a long trade on the daily chart might identify:
- Price above a rising slope 200 SMA (tide) = only look for long trades
- Price above a rising slope 50 SMA (trend) = confirms a healthy trend
- Price pulls back to 20 EMA (timing zone) = start watching for price action confirming the entry
- Crossovers like the "golden cross" (50 SMA crossing 200 SMA) are only contextual signals indicating trend shifts, don't use them as entry triggers.
- On faster charts (1-hour and 30-minute), multiple touches of moving averages happen frequently due to noise; thus, confirmation from price action, volume, or other indicators is essential.
The core takeaway here is that knowing precise moving average numbers is easy. Mastering the **patience, discipline, and risk management** to trade only when the tide, trend, and timing all align is what really separates successful traders from losing ones.
- Daily chart: 200 SMA, 50 SMA, 20 EMA
- 4 hour chart: 200 SMA, 50 EMA, 20 EMA
- 1 hour chart: 50 EMA, 20 EMA, 9 EMA
- 30 minute chart: 50 EMA, 20 EMA, 9 EMA
Moving Averages Are Filters, Not Triggers: The moving average smooths price action to reveal the dominant market current, not to provide buy or sell signals alone. It filters market noise but requires price action confirmation for entry decisions.Therefore it's important to note the **slope** direction of the MA too.
Matching Time Frame and Holding Period: Using a moving average setting built on a timeframe inconsistent with your trade duration (e.g., a short moving average on a multi-month trade) causes frequent whipsaws. The setting must reflect your trade horizon.
Three Roles of Moving Averages on Any Time Frame:
1. **Tide (Slowest Line)** — Indicates the overall market direction and which side to trade.
2. **Trend (Middle Line)** — Represents the active trend you trade around.
3. **Timing (Fastest Line)** — Identifies pullback zones and potential entry points.
Consistency and Discipline are Crucial: The hardest part of trading is not knowing the settings but patiently waiting for alignment of the tide, trend, and timing lines, and resisting impulsive trades.
When to use EMA or SMA: Shorter time frames use EMAs for faster reaction to price changes, whereas longer time frames use SMAs to smooth out noise and emphasize broader trends. The 200-day SMA is particularly important as it is the most widely followed moving average, creating real support/resistance due to collective market attention.
Examples and Practical Application:
- A trader looking for a long trade on the daily chart might identify:
- Price above a rising slope 200 SMA (tide) = only look for long trades
- Price above a rising slope 50 SMA (trend) = confirms a healthy trend
- Price pulls back to 20 EMA (timing zone) = start watching for price action confirming the entry
- Crossovers like the "golden cross" (50 SMA crossing 200 SMA) are only contextual signals indicating trend shifts, don't use them as entry triggers.
- On faster charts (1-hour and 30-minute), multiple touches of moving averages happen frequently due to noise; thus, confirmation from price action, volume, or other indicators is essential.
The core takeaway here is that knowing precise moving average numbers is easy. Mastering the **patience, discipline, and risk management** to trade only when the tide, trend, and timing all align is what really separates successful traders from losing ones.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.