g
Find a file
2025-11-16 14:26:19 +00:00
STRATEGIES Initial commit 2025-11-16 14:26:19 +00:00
CHANGELOG.md Initial commit 2025-11-16 14:26:19 +00:00
README.md Initial commit 2025-11-16 14:26:19 +00:00
SmartMA.mq5 Initial commit 2025-11-16 14:26:19 +00:00

# SmartMA MT5  
Context-Adaptive, Self-Explaining Moving Average for MetaTrader 5

by Steve Rosenstock  
Open Source Project – https://forge.mql5.io/steverosenstock/SmartMA

---

## Tags
MT5 · indicator · moving-average · adaptive · context-aware · news · session · volatility · regime · open-source · trading · technical-analysis · forex · alerts · community

---

## About

**SmartMA MT5** is a professional, open-source indicator for MetaTrader 5 that redefines the classic Moving Average (MA) for modern markets:

- **Context-aware:** Adapts automatically to trading session (Asia, London, New York), economic news, volatility regime, and volume spikes
- **Self-explaining:** Shows real-time chart comments explaining *why* MA adapts its settings (e.g., "MA frozen during ECB news")
- **Dual Output:** Main SmartMA (context-driven) plus a "Ghost" MA line (shows how MA would look without news bars)
- **Dynamic risk band:** Overlays SmartATR-style band for stop and risk visualization
- **Fully documented, open code:** Made for traders, strategists, and developers

**SmartMA MT5 is built for anyone who wants real context and transparency from their moving averages—no more "blind" signals.**

---

## Features

- **Adaptive period & type:** EMA, SMA, or VWMA—selected live based on regime
- **Session detection:** Recognizes Asian, London, and NY market hours
- **News integration:** Detects and reacts to economic news (native MT5 calendar)
- **Volume-driven:** Faster response to high-volume bars
- **Trend/range regime switching:** Adjusts smoothing in real time
- **Ghost MA:** "What-if" line excluding news bars
- **Dynamic risk band:** ATR-style overlay for stops/targets
- **Self-explaining logic:** Chart comments detail current regime and MA behavior
- **Visual overlays:** Line color/thickness/style reflect market phase and context
- **Alerts:** Regime change, news freeze, and high volatility
- **100% open source:** Fully transparent, ready for your strategies, EAs, or extensions

---

## Repository

- Project page: [SmartMA on forge.mql5.io](https://forge.mql5.io/steverosenstock/SmartMA)
- Git URL: https://forge.mql5.io/steverosenstock/SmartMA.git
- Author: Steve Rosenstock

---

## Installation

1. Download `SmartMA.mq5` from this repository
2. Copy to your MetaTrader 5 `/MQL5/Indicators/` folder
3. Open MetaEditor, compile the indicator
4. Attach SmartMA to any chart – all timeframes and assets supported

---

## Inputs

| Name           | Description                                           | Default       |
|----------------|------------------------------------------------------|---------------|
| MA_Period      | Initial MA period (adaptive logic applies)           | 20            |
| ATR_Period     | Period for risk band (ATR overlay)                   | 14            |
| Use_Volume     | Enable volume-weighted MA                            | true          |
| Use_News       | Enable economic news detection (native MT5 calendar) | true          |
| Show_Risk_Band | Show ATR-style risk band overlay                     | true          |
| Show_Ghost     | Show "Ghost" MA (excludes news bars)                 | true          |
| Enable_Alerts  | Pop-up/sound alerts for regime/news changes          | true          |

---

## How SmartMA MT5 Works

- **Calculates adaptive MA** using EMA logic, adjusted live for volume, session, and regime
- **Detects market context:**  
    - Session (Asia, London, NY) and news via MT5’s economic calendar
    - Changes color/thickness per regime (trend, range, news, etc.)
- **Shows chart comments:** Explains regime, period, session, news events—fully transparent
- **Overlays risk band:** ±ATR for stops and position sizing
- **Dual output:** Main MA (contextual), and "Ghost" MA (without news impact)
- **Alerts:** Pop-up (and/or sound) for regime switches, news freezes, and unusual volatility

---

## Example Output

- **Blue line:** Context-adaptive SmartMA  
- **Gray line:** "Ghost" MA (excludes news bars)  
- **Yellow band:** Risk overlay (ATR-based)  
- **Chart comment:** Explains current context (session, regime, news, period, etc.)  
- **Alerts:** Real-time notifications on key context shifts

---

## For Developers

- Code is modular and fully commented—ready for custom regimes, overlays, and integration in EAs
- Add your own context profiles, visual themes, or alert logic
- Forks, pull requests, bug reports, and suggestions are very welcome!

---

## Repository

https://forge.mql5.io/steverosenstock/SmartMA  
https://forge.mql5.io/steverosenstock/SmartMA.git

---

## License

MIT License – Free for all personal, professional, and commercial use.

---

## About the Author

Developed and maintained by **Steve Rosenstock**  
If you like this project or have ideas for improvements, your contribution is always welcome!

---

**SmartMA MT5 – The open-source, context-driven Moving Average for serious MetaTrader traders.  
Don't follow the herd—trade with context!**