DinexSpace Indicator Handle Library
- librerie
- Versione: 1.0
DinexSpace Indicator Handle Library is an MQL5 library for MetaTrader 5 (MT5) that creates indicator handles once, tells you whether they are ready, and reads their values with a clear status instead of silent failures.
What it supports
- Handles by ID: create moving average, RSI, ATR or custom indicator handles and keep them as small integer IDs. Up to 64 handles per program, and up to 8 numeric inputs for a custom indicator.
- Ready check: ask whether a handle has calculated enough bars before you read it.
- A status for every read: done, data not ready, no value available, invalid ID, copy failed or invalid parameter, each with a plain-English text such as "Data not ready".
- Closed-bar reads: read the last closed bar, or any shift, from any buffer. Empty and invalid values are reported, not returned as numbers.
- Safe release: release one handle or all of them; releasing a handle twice does nothing.
- Light: no DLLs, no web requests, no Sleep and no timers inside the library.
Integration
- Install the library from the Market.
- #import the functions you need.
- Create each handle once, check it is ready, then read and check the status of every call.
#import "DinexIndicatorHandle.ex5"
int DxIhCreateATR(const string symbol, const ENUM_TIMEFRAMES tf, const int period);
bool DxIhReady(const int id);
int DxIhReadClosed(const int id, const int buffer, double &value);
void DxIhReleaseAll();
string DxIhStatusText(const int code);
#import
int g_atr = -1;
int OnInit()
{
g_atr = DxIhCreateATR(_Symbol, (ENUM_TIMEFRAMES)_Period, 14);
return (g_atr >= 0) ? INIT_SUCCEEDED : INIT_FAILED;
}
void OnTick()
{
double atr = 0.0;
int status = DxIhReadClosed(g_atr, 0, atr);
if(status != 0)
Print("not read: ", DxIhStatusText(status));
}
void OnDeinit(const int reason)
{
DxIhReleaseAll();
}
Notes
- The library keeps its own table for each program that uses it. Create handles in OnInit and release them in OnDeinit.
- It reads indicator values only. It does not open or close trades.
About the screenshots
- The log screenshot comes from a small example EA built on the integration code above. In the Strategy Tester it creates three handles and reads closed-bar values on every new bar, then counts the results.
- The product itself is the library file only.
