bar/README.md

77 Zeilen
3,6 KiB
Markdown

2026-02-03 06:07:24 -03:00
# Package bar
2025-12-17 13:16:32 +00:00
2026-02-02 12:52:43 -03:00
**Simple, fast and reliable bar access with time series and new bar detection**
2025-12-23 10:27:02 -03:00
*MIT License*
2025-12-17 11:30:54 -03:00
---
## What is this?
2026-02-02 12:52:43 -03:00
`bar` is a **demonstration project** that showcases how to use **KnitPkg for MetaTrader** to manage MQL5 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.
2025-12-17 11:30:54 -03:00
2026-01-07 15:34:50 -03:00
The project is intended **only as an educational example** of how to structure, package and compile MQL5 code with KnitPkg – it is **not** meant to be a production‑grade library for large-scale use.
2025-12-17 11:30:54 -03:00
## Features
2026-01-07 15:34:50 -03:00
- **Package type** (`type: package`) – header‑only library that can be consumed by other KnitPkg projects.
2026-02-02 12:52:43 -03:00
- **mql5 target** – works with MetaTrader5.
- **Compile support** – `kp compile` compiles the test suite.
2025-12-17 11:30:54 -03:00
2026-02-02 12:52:43 -03:00
## Adding `bar` as a dependency in your project
2025-12-17 11:30:54 -03:00
2026-02-03 13:02:19 +00:00
To incorporate the latest stable release of `bar` into your KnitPkg project, use the `add` command to include it as a dependency in your `knitpkg.yaml` file:
2025-12-17 11:30:54 -03:00
2026-02-03 13:02:19 +00:00
```bash
kp add @douglasrechia/bar
2025-12-17 11:30:54 -03:00
```
2026-02-03 13:02:19 +00:00
Note that the caret (^) prefixing the version number in the `knitpkg.yaml` manifest indicates that your project will receive minor and patch updates for `bar` during installation commands.
2025-12-19 11:03:35 +00:00
2026-02-03 13:02:19 +00:00
After adding the dependency, execute `kp install` to download `bar` for prompt use. For reproducible builds, you may opt to use `kp install --locked` to adhere to the locked version. Refer to the KnitPkg documentation for additional information.
2025-12-19 11:03:35 +00:00
2026-02-02 12:52:43 -03:00
## Downloading `bar` and running Unit tests (optional)
2025-12-17 11:30:54 -03:00
2026-01-07 15:34:50 -03:00
If you're interested in exploring how a KnitPkg package project is structured, do the following:
2025-12-17 11:30:54 -03:00
``` bash
# Change to your 'Scripts' source directory.
2025-12-17 11:43:15 -03:00
# How to find it: in the MetaEditor navigator, right‑click the `Scripts` folder and select "Open Folder".
2025-12-17 11:30:54 -03:00
cd "C:\Users\username\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Scripts"
# Clone the repository
2026-02-02 12:52:43 -03:00
git clone https://forge.mql5.io/DouglasRechia/bar.git
2025-12-17 11:30:54 -03:00
2026-02-02 12:52:43 -03:00
cd bar
2025-12-17 11:30:54 -03:00
# Compile the test script
2026-02-02 12:52:43 -03:00
kp compile
2025-12-17 11:30:54 -03:00
2025-12-17 12:51:40 -03:00
# Close MetaTrader and launch it again (needed to refresh navigator Scripts). Open any chart you want.
2026-02-03 06:06:10 -03:00
# The Unit tests compiled binaries will appear in MetaTrader navigator under the Scripts/bar/bin entry.
# Double‑click it to run the tests. See test results in the 'Scripts' tab.
```
Alternatively, execute the `get` command to query the registry for package metadata, enabling the automatic
download and compilation of the latest stable version.
``` bash
# Change to your MetaTrader Data folder directory. This is step is required only if you have
# more than one MetaTrader instalation.
# How to find it: in the MetaTrader navigator, click on menu File/Open data folder.
cd "C:\Users\username\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075"
kp get mql5 @douglasrechia/bar
# Close MetaTrader and launch it again (needed to refresh navigator Scripts). Open any chart you want.
2026-02-03 06:06:10 -03:00
# The Unit tests compiled binaries will appear in MetaTrader navigator under the Scripts/bar/bin entry.
2025-12-17 11:43:15 -03:00
# Double‑click it to run the tests. See test results in the 'Scripts' tab.
2025-12-17 11:30:54 -03:00
```
## 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.*