sma/README.md

90 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2026-02-12 14:37:39 -03:00
# Indicator sma
2025-12-18 13:11:42 +00:00
2026-02-12 14:37:39 -03:00
**Simple Moving Average indicator using KnitPkg packages**
*MIT License*
2026-01-01 19:56:34 -03:00
2026-02-12 14:37:39 -03:00
---
2026-01-01 19:56:34 -03:00
2026-02-12 14:37:39 -03:00
## What is this?
2026-01-01 19:56:34 -03:00
2026-02-12 14:37:39 -03:00
Indicator `sma` is a **demonstration project** that showcases how to build a MetaTrader 5 indicator by consuming KnitPkg packages.
2026-01-01 19:56:34 -03:00
2026-02-12 14:37:39 -03:00
It implements a complete **Simple Moving Average (SMA) indicator**, and is meant to be an educational example of how to structure an indicator project, manage dependencies, and compile MQL5 code with KnitPkg. It is **not** meant to be a production-grade trading system.
2026-01-01 19:56:34 -03:00
## Prerequisites
2026-02-12 14:37:39 -03:00
To build and use this project, you will need:
2026-01-01 19:56:34 -03:00
1. [**MetaTrader 5**](https://www.mql5.com/) installed.
2026-01-07 15:04:09 -03:00
2. **KnitPkg CLI**: The KnitPkg package manager for MetaTrader. If you don't have it, you can install it by following the instructions in the [main KnitPkg repository](https://github.com/knitpkg-dev/knitpkg-mt.git).
2026-02-12 14:37:39 -03:00
3. **KnitPkg homepage**: See [https://knitpkg.dev](https://knitpkg.dev) for an overview and [https://docs.knitpkg.dev](https://docs.knitpkg.dev) for documentation.
---
## Features
- **Indicator type** (`type: indicator`) — a complete indicator project (not a package)
- **SMA demo** — Simple Moving Average indicator
- **Dependency installation** — uses the KnitPkg registry to resolve and download dependencies
- **Dependencies**
- `@douglasrechia/calc` — SMA calculation utilities
- **MQL5 target** — designed for MetaTrader 5
- **Compile support** — `kp compile` builds the indicator into an `.ex5` binary
---
2026-01-01 19:56:34 -03:00
2026-02-12 14:37:39 -03:00
## One-command download/build via the registry
2026-01-01 19:56:34 -03:00
2026-02-12 14:37:39 -03:00
You can use `kp get` to query the registry for metadata and automatically download/build the latest stable version.
Example (run from your MetaTrader *Data Folder* root if you have MetaTrader installed in more than one location):
2026-01-01 19:56:34 -03:00
```bash
2026-02-12 14:37:39 -03:00
cd "C:\Users\username\AppData\Roaming\MetaQuotes\Terminal\<TERMINAL_ID>"
2026-01-01 19:56:34 -03:00
2026-02-12 14:37:39 -03:00
kp get mql5 @douglasrechia/sma
```
Restart MetaTrader afterward to refresh the Navigator.
2026-01-01 19:56:34 -03:00
2026-02-12 14:37:39 -03:00
---
2026-01-01 19:56:34 -03:00
2026-02-12 14:37:39 -03:00
## Exploring the project locally (optional)
2026-01-01 19:56:34 -03:00
2026-02-12 14:37:39 -03:00
If you want to explore how an indicator project is structured with KnitPkg, clone it into your MetaTrader `Indicators` folder.
### 1) Clone into MetaTrader `Indicators` folder (example)
```bash
# Go to your MetaTrader 'Indicators' directory.
# Tip: in MetaEditor, right-click the `Indicators` folder and choose "Open Folder".
cd "C:\Users\username\AppData\Roaming\MetaQuotes\Terminal\<TERMINAL_ID>\MQL5\Indicators"
git clone https://forge.mql5.io/DouglasRechia/sma.git
cd sma
2026-01-01 19:56:34 -03:00
```
2026-02-12 14:37:39 -03:00
### 2) Install dependencies
2026-02-02 16:26:18 -03:00
2026-02-12 14:37:39 -03:00
```bash
kp install
```
2026-02-02 16:26:18 -03:00
2026-02-12 14:37:39 -03:00
### 3) Compile
2026-02-02 16:26:18 -03:00
2026-02-12 14:37:39 -03:00
```bash
kp compile
2026-02-02 16:26:18 -03:00
```
2026-02-12 14:37:39 -03:00
---
2026-02-02 16:26:18 -03:00
2026-01-01 19:56:34 -03:00
## License
2026-02-12 14:37:39 -03:00
This project is released under the **MIT License**. See `LICENSE` for details.
---
2026-01-01 19:56:34 -03:00
## Disclaimer
2026-02-12 14:37:39 -03:00
This code is provided **as-is**, for **educational purposes only**.
No warranty (express or implied) is provided. Use at your own risk.