# trio707/moving-average-ea-1 architecture

> Architecture diagram of the GitHub repository trio707/moving-average-ea-1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/trio707/moving-average-ea-1
- Repository: https://github.com/trio707/moving-average-ea-1

## Overview

This single-file MetaTrader 5 Expert Advisor turns SMA crossover signals into trades, then manages their risk and exits. The README documents session/day filters, risk-based sizing, fixed 2:1 stop-loss/take-profit placement, break-even protection, staged profit-taking, and reduction on adverse movement. These are logical responsibilities within one implementation file, not separately verified modules; the relationships shown are limited to the documented workflow.

Main entry points: [`MovingAverageEA1.mq5`](https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5) (Trade Execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_trader(("Trader"))
node_market[("Market Prices")]
node_signals["SMA Signals"]
node_filters["Session Filters"]
node_sizing["Risk Sizing"]
node_execution["Trade Execution"]
node_management["Trade Management"]
node_platform["MetaTrader 5"]

node_market -->|"provides prices"| node_signals
node_signals -->|"triggers trades"| node_execution
node_trader -->|"configures schedule"| node_filters
node_filters -->|"gates trading"| node_execution
node_sizing -->|"sizes positions"| node_execution
node_execution -->|"executes trades"| node_platform
node_execution -->|"sets trade levels"| node_management
node_management -->|"manages positions"| node_platform

click node_signals "https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5"
click node_filters "https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5"
click node_sizing "https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5"
click node_execution "https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5"
click node_management "https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5"

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_trader,node_platform toneIndigo
class node_market toneAmber
class node_signals,node_filters,node_sizing,node_execution,node_management toneTeal
```

## Components

### Other components

- **Trader**
- **Market Prices**
- [SMA Signals](https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5): `MovingAverageEA1.mq5`
- [Session Filters](https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5): `MovingAverageEA1.mq5`
- [Risk Sizing](https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5): `MovingAverageEA1.mq5`
- [Trade Execution](https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5): `MovingAverageEA1.mq5`
- [Trade Management](https://github.com/trio707/moving-average-ea-1/blob/main/MovingAverageEA1.mq5): `MovingAverageEA1.mq5`
- **MetaTrader 5**

## Connections

- Market Prices → SMA Signals: provides prices (evidence: `README.md`)
- SMA Signals → Trade Execution: triggers trades (evidence: `README.md`)
- Trader → Session Filters: configures schedule (evidence: `README.md`)
- Session Filters → Trade Execution: gates trading (evidence: `README.md`)
- Risk Sizing → Trade Execution: sizes positions (evidence: `README.md`)
- Trade Execution → MetaTrader 5: executes trades (evidence: `README.md`)
- Trade Execution → Trade Management: sets trade levels (evidence: `README.md`)
- Trade Management → MetaTrader 5: manages positions (evidence: `README.md`)
