No description
Find a file
2026-02-13 10:03:03 -03:00
knitpkg feat: implement crossing moving average strategy 2026-02-13 09:58:58 -03:00
src feat: implement crossing moving average strategy 2026-02-13 09:58:58 -03:00
.gitignore Version 1.0.0 2026-02-03 06:42:44 -03:00
knitpkg.yaml feat: implement crossing moving average strategy 2026-02-13 10:03:03 -03:00
LICENSE Initial creation 2025-12-17 17:05:41 -03:00
README.md feat: implement crossing moving average strategy 2026-02-13 09:58:58 -03:00

EA expertdemo

Moving average crossover strategy (with entry filter) using KnitPkg packages
MIT License


What is this?

EA expertdemo is a demonstration project that showcases how to build a MetaTrader 5 Expert Advisor (EA) by consuming KnitPkg packages.

It implements a complete moving average crossover strategy with an entry filter, and is meant to be an educational example of how to structure an EA project, manage dependencies, and compile MQL5 code with KnitPkg. It is not meant to be a production-grade trading system.

Prerequisites

To build and use this project, you will need:

  1. MetaTrader 5 installed.
  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.
  3. KnitPkg homepage: See https://knitpkg.dev for an overview and https://docs.knitpkg.dev for documentation.
  4. Required indicator: KnitPkgSMA.ex5 must be installed
    • This EA reads the KnitPkgSMA indicator, so the compiled indicator binary must exist in your MetaTrader environment.

    • You can install it with:

      kp get mql5 @douglasrechia/sma
      
    • The sma project repository is here.


Features

  • Expert Advisor type (type: expert) — a complete EA project (not a package)
  • Strategy demo — moving average crossover with an entry filter
  • Dependency installation — uses the KnitPkg registry to resolve and download dependencies
  • Dependencies
    • @douglasrechia/bar — bar access utilities and bar/time-series abstractions
    • @douglasrechia/barhelper — helper utilities built on top of bar (for example, crossover helpers)
  • MQL5 target — designed for MetaTrader 5
  • Compile supportkp compile builds the EA into an .ex5 binary

One-command download/build via the registry

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):

cd "C:\Users\username\AppData\Roaming\MetaQuotes\Terminal\<TERMINAL_ID>"

kp get mql5 @douglasrechia/expertdemo

Restart MetaTrader afterward to refresh the Navigator.


Exploring the project locally (optional)

If you want to explore how an EA project is structured with KnitPkg, clone it into your MetaTrader Experts folder.

1) Clone into MetaTrader Experts folder (example)

# Go to your MetaTrader 'Experts' directory.
# Tip: in MetaEditor, right-click the `Experts` folder and choose "Open Folder".
cd "C:\Users\username\AppData\Roaming\MetaQuotes\Terminal\<TERMINAL_ID>\MQL5\Experts"

git clone https://forge.mql5.io/DouglasRechia/expertdemo.git
cd expertdemo

2) Install dependencies

kp install

3) Compile

kp compile

License

This project is released under the MIT License. See LICENSE for details.


Disclaimer

This code is provided as-is, for educational purposes only.
No warranty (express or implied) is provided. Use at your own risk.