56 lines
1.9 KiB
MQL5
56 lines
1.9 KiB
MQL5
|
//+------------------------------------------------------------------+
|
||
|
//| NonEmbeddedIndicator.mq5 |
|
||
|
//| Copyright 2022, MetaQuotes Ltd. |
|
||
|
//| https://www.mql5.com |
|
||
|
//+------------------------------------------------------------------+
|
||
|
#property indicator_chart_window
|
||
|
#property indicator_buffers 0
|
||
|
#property indicator_plots 0
|
||
|
|
||
|
input int Reference = 0;
|
||
|
|
||
|
int handle = 0;
|
||
|
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Indicator initialization function |
|
||
|
//+------------------------------------------------------------------+
|
||
|
int OnInit()
|
||
|
{
|
||
|
const string name = MQLInfoString(MQL_PROGRAM_NAME);
|
||
|
const string path = MQLInfoString(MQL_PROGRAM_PATH);
|
||
|
Print(Reference);
|
||
|
Print("Name: " + name);
|
||
|
Print("Full path: " + path);
|
||
|
|
||
|
if(Reference == 0)
|
||
|
{
|
||
|
handle = iCustom(_Symbol, _Period, name, 1);
|
||
|
if(handle == INVALID_HANDLE)
|
||
|
{
|
||
|
return INIT_FAILED;
|
||
|
}
|
||
|
}
|
||
|
Print("Success");
|
||
|
return INIT_SUCCEEDED;
|
||
|
}
|
||
|
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Indicator calculation function (dummy here) |
|
||
|
//+------------------------------------------------------------------+
|
||
|
int OnCalculate(const int rates_total,
|
||
|
const int prev_calculated,
|
||
|
const int begin,
|
||
|
const double &price[])
|
||
|
{
|
||
|
return rates_total;
|
||
|
}
|
||
|
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Indicator finalization function |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void OnDeinit(const int)
|
||
|
{
|
||
|
IndicatorRelease(handle);
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|