# maxime-fintech/pine-to-mql5-ema-slope-cross architecture

> Architecture diagram of the GitHub repository maxime-fintech/pine-to-mql5-ema-slope-cross, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maxime-fintech/pine-to-mql5-ema-slope-cross
- Repository: https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross

## Overview

This is an MT5 Expert Advisor that converts the TradingView EMA Slope + EMA Cross strategy into automated trading. The principal workflow is attaching the EA to a chart, evaluating EMA and slope/crossover signals, then opening or reversing a position; alerts and chart visualization are additional capabilities. The README documents the modules and their roles, but no source excerpts were provided, so internal call ownership and finer-grained runtime links cannot be verified.

Main entry points: [`src/EMA_Slope_Cross_EA.mq5`](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/EMA_Slope_Cross_EA.mq5) (Expert Advisor), [`src/modules/trade_executor.mqh`](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/trade_executor.mqh) (Position execution), [`tradingview/original_script.pine`](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/tradingview/original_script.pine) (Original strategy), [`src/modules/ema_calc.mqh`](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/ema_calc.mqh) (EMA calculations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_strategy["Signal strategy"]
  node_ea["Expert Advisor"]
  node_ema["EMA calculations<br/>[ema_calc.mqh]"]
  node_slope["Slope and crosses<br/>[slope_calc.mqh]"]
end

subgraph group_presentation["Alerts and charts"]
  node_alerts["Entry and exit alerts<br/>[alerts.mqh]"]
  node_bars["Slope bar colors<br/>[DrawBar.mqh]"]
  node_drawema["EMA visualization<br/>[DrawEMA.mqh]"]
end

subgraph group_execution["Trade execution"]
  node_trades["Position execution<br/>[trade_executor.mqh]"]
end

subgraph group_reference["TradingView reference"]
  node_pine["Original strategy"]
end

node_user(("EA user"))
node_mt5["MT5 chart"]
node_broker["MT5 trading services"]

node_user -->|"attaches EA"| node_mt5
node_mt5 -->|"runs on chart"| node_ea
node_ea -->|"uses calculations"| node_ema
node_ea -->|"evaluates signals"| node_slope
node_pine -->|"strategy converted"| node_ea
node_ea -->|"manages positions"| node_trades
node_trades -->|"executes trades"| node_broker
node_ea -->|"dispatches alerts"| node_alerts
node_ea -->|"colors bars"| node_bars
node_ea -->|"draws averages"| node_drawema

click node_ea "https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/EMA_Slope_Cross_EA.mq5"
click node_ema "https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/ema_calc.mqh"
click node_slope "https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/slope_calc.mqh"
click node_pine "https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/tradingview/original_script.pine"
click node_trades "https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/trade_executor.mqh"
click node_alerts "https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/alerts.mqh"
click node_bars "https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/DrawBar.mqh"
click node_drawema "https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/DrawEMA.mqh"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ea,node_ema,node_slope,node_user toneBlue
class node_alerts,node_bars,node_drawema toneAmber
class node_trades toneMint
class node_pine toneRose
class node_mt5,node_broker toneIndigo
```

## Components

### Signal strategy

- [Expert Advisor](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/EMA_Slope_Cross_EA.mq5): `src/EMA_Slope_Cross_EA.mq5`
- [EMA calculations](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/ema_calc.mqh): `src/modules/ema_calc.mqh`
- [Slope and crosses](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/slope_calc.mqh): `src/modules/slope_calc.mqh`

### Alerts and charts

- [Entry and exit alerts](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/alerts.mqh): `src/modules/alerts.mqh`
- [Slope bar colors](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/DrawBar.mqh): `src/modules/DrawBar.mqh`
- [EMA visualization](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/DrawEMA.mqh): `src/modules/DrawEMA.mqh`

### Trade execution

- [Position execution](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/src/modules/trade_executor.mqh): `src/modules/trade_executor.mqh`

### TradingView reference

- [Original strategy](https://github.com/maxime-fintech/pine-to-mql5-ema-slope-cross/blob/main/tradingview/original_script.pine): `tradingview/original_script.pine`

### Other components

- **EA user**
- **MT5 chart**
- **MT5 trading services**

## Connections

- EA user → MT5 chart: attaches EA (evidence: `README.md`)
- MT5 chart → Expert Advisor: runs on chart (evidence: `README.md`)
- Expert Advisor → EMA calculations: uses calculations (evidence: `README.md`)
- Expert Advisor → Slope and crosses: evaluates signals (evidence: `README.md`)
- Original strategy → Expert Advisor: strategy converted (evidence: `README.md`)
- Expert Advisor → Position execution: manages positions (evidence: `README.md`)
- Position execution → MT5 trading services: executes trades (evidence: `README.md`)
- Expert Advisor → Entry and exit alerts: dispatches alerts (evidence: `README.md`)
- Expert Advisor → Slope bar colors: colors bars (evidence: `README.md`)
- Expert Advisor → EMA visualization: draws averages (evidence: `README.md`)
