OPEN-SOURCE SCRIPT
Andrei Marin4 EMA MTF (M5 + M30) – Buy/Sell on Close Above/Below

🚀 4 EMA MTF (M5 + M30) — Trend Power Confirmation System
Catch the trend before it takes off.
This indicator fuses multi-timeframe momentum and precision trend alignment using 4 EMAs (2 from M5 + 2 from M30). When short- and mid-term trends lock in the same direction, you get clean, high-probability Buy and Sell signals — confirmed only on bar close, no repainting.
💡 The Concept
In trending markets, real consistency comes from multi-timeframe confluence.
This tool reads both your local M5 chart and the higher-timeframe M30 to detect moments when price breaks above or below all four EMAs — meaning both intraday and swing flows are aligned.
When the M5 and M30 EMAs agree, it’s not noise — it’s momentum.
✅ BUY → Price closes above all 4 EMAs
❌ SELL → Price closes below all 4 EMAs
🔒 No repaint: All conditions confirmed after bar close.
🔍 Features
🧭 4 EMA Fusion: EMA 20 & 50 on both M5 and M30 for double-layer confirmation.
⚡ Instant Visuals: Arrows mark fresh buy/sell signals only when trend alignment occurs.
🎨 Dynamic Background: Teal = bullish control, Red = bearish momentum.
🔔 Built-in Alerts: Receive instant notifications when new signals trigger.
🧩 Customizable: Change EMA lengths, higher-timeframe (HTF), or turn visuals on/off.
🧠 How It Works
Local EMAs (M5): Fast/Slow smoothing of short-term trend.
Higher-TF EMAs (M30): Pulled securely with request.security() and no repaint settings (lookahead_off).
Signals appear only once, when a new alignment is confirmed on close — eliminating fake flips.
⚙️ Inputs
Category Parameter Default Description
M5 Settings EMA rapide / EMA lente 20 / 50 Short-term trend layer
M30 Settings Timeframe HTF 30 Medium-term confirmation
M30 EMAs EMA rapide / EMA lente 20 / 50 Higher-timeframe trend filter
Display Show Labels / Background ON / ON Optional visuals
🧭 Why Traders Love It
🔹 Crystal-clear direction — no second guessing trend bias
🔹 No laggy repainting tricks — only confirmed data
🔹 Adaptable for all assets — Forex, Indices, Crypto, Metals
🔹 Perfect companion for scalpers and intraday swing traders
This is your trend alignment radar — simple, visual, and powerful.
🔔 Alerts
BUY ALERT: “Close above EMA20/50 (M5 + M30)”
SELL ALERT: “Close below EMA20/50 (M5 + M30)”
You can connect these alerts to bots, webhooks, or notifications — stay synced with every confirmed breakout.
⚠️ Notes
This is a confirmation tool, not a standalone entry system. Combine it with:
Structure breaks or liquidity sweeps
ATR-based stop losses
Volume or session filters
🌍 Summary
4 EMA MTF (M5 + M30) delivers multi-timeframe precision with clean, non-repainting signals that align your short-term and mid-term trends.
Designed for traders who demand clarity, momentum, and discipline.
💬 “When M5 and M30 agree — the trend just got serious.”
Catch the trend before it takes off.
This indicator fuses multi-timeframe momentum and precision trend alignment using 4 EMAs (2 from M5 + 2 from M30). When short- and mid-term trends lock in the same direction, you get clean, high-probability Buy and Sell signals — confirmed only on bar close, no repainting.
💡 The Concept
In trending markets, real consistency comes from multi-timeframe confluence.
This tool reads both your local M5 chart and the higher-timeframe M30 to detect moments when price breaks above or below all four EMAs — meaning both intraday and swing flows are aligned.
When the M5 and M30 EMAs agree, it’s not noise — it’s momentum.
✅ BUY → Price closes above all 4 EMAs
❌ SELL → Price closes below all 4 EMAs
🔒 No repaint: All conditions confirmed after bar close.
🔍 Features
🧭 4 EMA Fusion: EMA 20 & 50 on both M5 and M30 for double-layer confirmation.
⚡ Instant Visuals: Arrows mark fresh buy/sell signals only when trend alignment occurs.
🎨 Dynamic Background: Teal = bullish control, Red = bearish momentum.
🔔 Built-in Alerts: Receive instant notifications when new signals trigger.
🧩 Customizable: Change EMA lengths, higher-timeframe (HTF), or turn visuals on/off.
🧠 How It Works
Local EMAs (M5): Fast/Slow smoothing of short-term trend.
Higher-TF EMAs (M30): Pulled securely with request.security() and no repaint settings (lookahead_off).
Signals appear only once, when a new alignment is confirmed on close — eliminating fake flips.
⚙️ Inputs
Category Parameter Default Description
M5 Settings EMA rapide / EMA lente 20 / 50 Short-term trend layer
M30 Settings Timeframe HTF 30 Medium-term confirmation
M30 EMAs EMA rapide / EMA lente 20 / 50 Higher-timeframe trend filter
Display Show Labels / Background ON / ON Optional visuals
🧭 Why Traders Love It
🔹 Crystal-clear direction — no second guessing trend bias
🔹 No laggy repainting tricks — only confirmed data
🔹 Adaptable for all assets — Forex, Indices, Crypto, Metals
🔹 Perfect companion for scalpers and intraday swing traders
This is your trend alignment radar — simple, visual, and powerful.
🔔 Alerts
BUY ALERT: “Close above EMA20/50 (M5 + M30)”
SELL ALERT: “Close below EMA20/50 (M5 + M30)”
You can connect these alerts to bots, webhooks, or notifications — stay synced with every confirmed breakout.
⚠️ Notes
This is a confirmation tool, not a standalone entry system. Combine it with:
Structure breaks or liquidity sweeps
ATR-based stop losses
Volume or session filters
🌍 Summary
4 EMA MTF (M5 + M30) delivers multi-timeframe precision with clean, non-repainting signals that align your short-term and mid-term trends.
Designed for traders who demand clarity, momentum, and discipline.
💬 “When M5 and M30 agree — the trend just got serious.”
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.