MQL5Book/Indicators/p5/LifeCycle.mq5
super.admin 1c8e83ce31 convert
2025-05-30 16:09:41 +02:00

60 lines
2 KiB
MQL5

//+------------------------------------------------------------------+
//| LifeCycle.mq5 |
//| Copyright 2021, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots 0
#include "..\..\Include\Uninit.mqh"
input int Fake = 0;
//+------------------------------------------------------------------+
//| Global initialization/finalization trap |
//+------------------------------------------------------------------+
class Loader
{
static Loader object;
Loader()
{
Print(__FUNCSIG__);
}
~Loader()
{
Print(__FUNCSIG__);
}
};
static Loader Loader::object;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void OnInit()
{
Print(__FUNCSIG__, " ", Fake, " ",
EnumToString((ENUM_DEINIT_REASON)_UninitReason));
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const int begin,
const double &price[])
{
return rates_total;
}
//+------------------------------------------------------------------+
//| Finalization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
Print(__FUNCSIG__, " ", EnumToString((ENUM_DEINIT_REASON)reason));
}
//+------------------------------------------------------------------+