MQLArticles/Utils/FA/README.md
2026-09-06 11:15:27 -05:00

40 lines
1.1 KiB
Markdown

[← Utils](../README.md)
# Utils/FA
Shared base classes used across the ecosystem: ATR access, bar control, auto-cleanup, simple logging, diffs and sorting.
## Main features
- ATR wrapper for indicator access (`CAtr` and related classes in `Atr.mqh`).
- Bar-change detection helpers, including per-timeframe variants (`CBarControler`, `CBarControlerFastW1`, `CBarControlerFastMN1`, `CBarControlerFastMinors`).
- Automatic pointer cleanup on deinit (`CAutoCleaner`).
- Lightweight logging base used by other modules (`CLoggerBase`).
- Distance/diff calculators — by points or by ATR (`CDiff`, `CDiffPoint`, `CDiffAtr`).
- Simple array sorting (`CSimpleSort`).
## Basic usage
### Bar control
```mql5
CBarControler bar_ctrl;
bar_ctrl.Init(_Symbol, PERIOD_CURRENT);
if(bar_ctrl.IsNewBar())
{
// new bar logic
}
```
### Auto-cleanup
```mql5
CAtr* g_atr = new CAtr();
g_atr.Create(_Period, _Symbol, 14, true, true);
CAutoCleaner::AddPtr(g_atr); // will be deleted automatically on deinit
```
### Diff by ATR
```mql5
CDiffAtr* diff = CreateDiffptr(MODE_DIFF_BY_ATR, _Symbol, g_atr, 0, 1.5);
```
> Only the most representative classes are shown here.