65 lines
2.9 KiB
Markdown
65 lines
2.9 KiB
Markdown
# knitpkg-mt4-bar
|
||
|
||
**Simple, fast and reliable bar access with NewBar detection**
|
||
*MIT License*
|
||
|
||
---
|
||
|
||
## What is this?
|
||
|
||
`knitpkg-mt4-bar` is a **demonstration project** that showcases how to use **KnitPkg for MetaTrader** to manage MQL4 packages.
|
||
It provides a small, self‑contained package that provides interfaces such as `IBar` and `ITimeSeries` along with actual
|
||
implementations to provide access to broker data, together with a tiny test suite.
|
||
|
||
The project is intended **only as an educational example** of how to structure, package and compile MQL4 code with KnitPkg – it is **not** meant to be a production‑grade library for large-scale use.
|
||
|
||
## Features
|
||
|
||
- **Package type** (`type: package`) – header‑only library that can be consumed by other KnitPkg projects.
|
||
- **MQL4 target** – works with MetaTrader 5.
|
||
- **Compile support** – `kp-mt compile` compiles the test suite.
|
||
|
||
## Adding `knitpkg-mt4-bar` as a dependency in your project
|
||
|
||
To use `knitpkg-mt4-bar` in your own KnitPkg project, add it as a dependency in your `knitpkg.yaml` file:
|
||
|
||
``` yaml
|
||
dependencies:
|
||
'@knitpkg.dev/knitpkg-mt4-bar': https://forge.MQL4.io/DouglasRechia/knitpkg-mt4-bar.git#^1.0.0
|
||
```
|
||
|
||
When you run `kp-mt install`, KnitPkg will automatically download `knitpkg-mt4-bar` into your project.
|
||
|
||
Notice the caret ^ preceding the version number: it means your project will get any minor or patch changes in
|
||
`knitpkg-mt4-bar` automatically whenever you issue the install command (that is, any SemVer tag like 2.x.y). Alternatively, you can run `kp-mt install --locked` to use the locked version, ensuring reproducible releases of your project. See KnitPkg docs for more details.
|
||
|
||
## Downloading `knitpkg-mt4-bar` and running Unit tests (optional)
|
||
|
||
If you're interested in exploring how a KnitPkg package project is structured, do the following:
|
||
|
||
``` bash
|
||
# Change to your 'Scripts' source directory.
|
||
# How to find it: in the MetaEditor navigator, right‑click the `Scripts` folder and select "Open Folder".
|
||
cd "C:\Users\username\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL4\Scripts"
|
||
|
||
# Clone the repository
|
||
git clone https://forge.MQL4.io/DouglasRechia/knitpkg-mt4-bar.git
|
||
|
||
cd knitpkg-mt4-bar
|
||
|
||
# Compile the test script
|
||
kp-mt compile
|
||
|
||
# Close MetaTrader and launch it again (needed to refresh navigator Scripts). Open any chart you want.
|
||
# The compiled binary `UnitTests.ex5` will appear in MetaTrader navigator under the Scripts/knitpkg-mt4-bar entry.
|
||
# Double‑click it to run the tests. See test results in the 'Scripts' tab.
|
||
```
|
||
|
||
## License
|
||
|
||
This project is released under the **MIT License**. See the `LICENSE` file for the full text.
|
||
|
||
## Disclaimer
|
||
|
||
*The author provides this code **as‑is**, for **educational purposes only**.
|
||
No warranty, express or implied, is given. The author assumes **no liability** for any damages, losses, or legal consequences that may arise from using, modifying, or distributing this software. Use it at your own risk.*
|