← К каталогу
Исходный код · ID 1452

colorzerolagrvi.mq4

Вы автор или правообладатель?

Сообщите нам, если считаете, что материал размещён без разрешения.

Краткий обзор

О программе

Индикатор ZerolagRVI — это пользовательский технический индикатор для MetaTrader 4, основанный на относительной силе движения (RVI) с零-задержкой сглаживания. Он рассчитывает пять осцилляторов RVI с различными периодами и коэффициентами, объединяет их в быструю линию тренда и применяет экспоненциальное сглаживание для получения медленной линии. При пересечении быстрой и медленной линий генерируются визуальные и оповещающие сигналы.

Индикатор поддерживает два режима отображения: стрелки в точках пересечения или цветное изменение свечей. Встроенная система оповещений позволяет настраивать уведомления в виде всплывающих окон, электронных писем, push-уведомлений, звуковых сигналов, а также запуск внешних программ и расширенных оповещений через DLL.

Индикатор работает на любом таймфрейме и инструменте, доступном в MetaTrader 4, и использует стандартный фреймворк MQL4 для расчёта и отрисовки данных на отдельном подокне графика.

Настройки программы

НастройкаОписание
smoothing Сглаживание — Параметр сглаживания для расчёта медленной линии тренда
Factor1 Коэффициент 1 — Коэффициент первого осциллятора RVI
RVI_period1 Период RVI 1 — Период первого осциллятора RVI
Factor2 Коэффициент 2 — Коэффициент второго осциллятора RVI
RVI_period2 Период RVI 2 — Период второго осциллятора RVI
Factor3 Коэффициент 3 — Коэффициент третьего осциллятора RVI
RVI_period3 Период RVI 3 — Период третьего осциллятора RVI
Factor4 Коэффициент 4 — Коэффициент четвёртого осциллятора RVI
RVI_period4 Период RVI 4 — Период четвёртого осциллятора RVI
Factor5 Коэффициент 5 — Коэффициент пятого осциллятора RVI
RVI_period5 Период RVI 5 — Период пятого осциллятора RVI
Signal mode (signal_mode) Режим сигнала — Режим генерации сигналов: в реальном времени или при закрытии бара
Presentation Type (Type) Тип отображения — Тип визуального отображения индикатора: стрелки или цвет свечей
Shift arrows (shift_arrows_pips) Сдвиг стрелок (пипсы) — Сдвиг стрелок индикатора в пунктах цены
Up color (up_color) Цвет роста — Цвет индикатора при восходящем сигнале
Down color (down_color) Цвет падения — Цвет индикатора при нисходящем сигнале
== Alerts == (AlertsSection) Раздел оповещений — Параметр секции оповещений для настройки блока уведомлений
Popup message (popup_alert) Всплывающее сообщение — Включает всплывающие сообщения на графике
Push notification (notification_alert) Push-уведомление — Включает push-уведомления на мобильные устройства
Email (email_alert) Email-уведомление — Включает отправку оповещений по электронной почте
Play sound on alert (play_sound) Звуковой сигнал — Включает воспроизведение звукового сигнала при срабатывании оповещения
Sound file (sound_file) Файл звука — Путь к файлу звука для оповещения
Start external program (start_program) Запуск программы — Включает запуск внешней программы при срабатывании оповещения
Advanced alert (Telegram/Discord/other platform (like another MT4)) (advanced_alert) Расширенное оповещение — Включает расширенные оповещения через Telegram, Discord или другие платформы
Comment2 Комментарий 2 — Дополнительный комментарий с информацией
Comment3 Комментарий 3 — Дополнительный комментарий с информацией
Comment4 Комментарий 4 — Дополнительный комментарий с информацией
Получить полный код

Поиск по коду файла

#property version   "1.0"
#property strict

#property indicator_separate_window
#property indicator_buffers 19
#property indicator_color1 clrBlueViolet
#property indicator_color2 clrBlueViolet

input uint   smoothing=15;

input double Factor1=0.05;
input int    RVI_period1=8;

input double Factor2=0.10;
input int    RVI_period2=21;

input double Factor3=0.16;
input int    RVI_period3=34;

input double Factor4=0.26;
input int    RVI_period4=55;

input double Factor5=0.43;
input int    RVI_period5=89;

enum SingalMode
{
   SingalModeLive, // Live
   SingalModeOnBarClose // On bar close
};

enum DisplayType
{
   Arrows, // Arrows
   Candles // Candles Color
};
input SingalMode signal_mode = SingalModeLive; // Signal mode
input DisplayType Type = Arrows; // Presentation Type
input double shift_arrows_pips = 0.1; // Shift arrows
input color up_color = Green; // Up color
input color down_color = Red; // Down color

string IndicatorName;
string IndicatorObjPrefix;

string GenerateIndicatorName(const string target)
{
   string name = target;
   int try = 2;
   while (WindowFind(name) != -1)
   {
      name = target + " #" + IntegerToString(try++);
   }
   return name;
}

double FastBuffer[];

#ifndef CustomStream_IMP
#define CustomStream_IMP

#ifndef AStream_IMP

interface IStream
{
public:
   virtual void AddRef() = 0;
   virtual void Release() = 0;

   virtual bool GetValue(const int period, double &val) = 0;
};

class InstrumentInfo
{
   string _symbol;
   double _mult;
   double _point;
   double _pipSize;
   int _digits;
   double _tickSize;
public:
   InstrumentInfo(const string symbol)
   {
      _symbol = symbol;
      _point = MarketInfo(symbol, MODE_POINT);
      _digits = (int)MarketInfo(symbol, MODE_DIGITS); 
      _mult = _digits == 3 || _digits == 5 ? 10 : 1;
      _pipSize = _point * _mult;
      _tickSize = MarketInfo(_symbol, MODE_TICKSIZE);
   }

   static double GetBid(const string symbol) { return MarketInfo(symbol, MODE_BID); }
   double GetBid() { return GetBid(_symbol); }
   static double GetAsk(const string symbol) { return MarketInfo(symbol, MODE_ASK); }
   double GetAsk() { return GetAsk(_symbol); }
   static double GetPipSize(const string symbol)
   { 
      double point = MarketInfo(symbol, MODE_POINT);
      double digits = (int)MarketInfo(symbol, MODE_DIGITS); 
      double mult = digits == 3 || digits == 5 ? 10 : 1;
      return point * mult;
   }
   double GetPipSize() { return _pipSize; }
   double GetPointSize() { return _point; }
   string GetSymbol() { return _symbol; }
   double GetSpread() { return (GetAsk() - GetBid()) / GetPipSize(); }
   int GetDigits() { return _digits; }
   double GetTickSize() { return _tickSize; }
   double GetMinLots() { return SymbolInfoDouble(_symbol, SYMBOL_VOLUME_MIN); };

   double RoundRate(const double rate)
   {
      return NormalizeDouble(MathFloor(rate / _tickSize + 0.5) * _tickSize, _digits);
   }
};

class AStream : public IStream
{
protected:
   string _symbol;
   ENUM_TIMEFRAMES _timeframe;
   double _shift;
   InstrumentInfo *_instrument;
   int _references;

   AStream(const string symbol, const ENUM_TIMEFRAMES timeframe)
   {
      _references = 1;
      _shift = 0.0;
      _symbol = symbol;
      _timeframe = timeframe;
      _instrument = new InstrumentInfo(_symbol);
   }

   ~AStream()
   {
      delete _instrument;
   }
public:
   void SetShift(const double shift)
   {
      _shift = shift;
   }

   void AddRef()
   {
      ++_references;
   }

   void Release()
   {
      --_references;
      if (_references == 0)
         delete &this;
   }
};
#define AStream_IMP
#endif

class CustomStream : public AStream
{
public:
   double _stream[];

   CustomStream(const string symbol, const ENUM_TIMEFRAMES timeframe)
      :AStream(symbol, timeframe)
   {
   }

   int RegisterStream(int id, color clr, int width, ENUM_LINE_STYLE style, string name)
   {
      SetIndexBuffer(id, _stream);
      SetIndexStyle(id, DRAW_LINE, style, width, clr);
      SetIndexLabel(id, name);
      return id + 1;
   }

   int RegisterInternalStream(int id)
   {
      SetIndexBuffer(id, _stream);
      SetIndexStyle(id, DRAW_NONE);
      return id + 1;
   }

   bool GetValue(const int period, double &val)
   {
      val = _stream[period];
      return _stream[period] != EMPTY_VALUE;
   }
};

#endif
CustomStream* _slow;
double smoothConst;

#ifndef ABaseCondition_IMP
#define ABaseCondition_IMP

interface ICondition
{
public:
   virtual void AddRef() = 0;
   virtual void Release() = 0;
   virtual bool IsPass(const int period) = 0;
};

#ifndef ACondition_IMP
#define ACondition_IMP

class ACondition : public ICondition
{
   int _references;
public:
   ACondition()
   {
      _references = 1;
   }

   virtual void AddRef()
   {
      ++_references;
   }

   virtual void Release()
   {
      --_references;
      if (_references == 0)
         delete &this;
   }
};

#endif

class ABaseCondition : public ACondition
{
protected:
   ENUM_TIMEFRAMES _timeframe;
   InstrumentInfo *_instrument;
   string _symbol;
public:
   ABaseCondition(const string symbol, ENUM_TIMEFRAMES timeframe)
   {
      _instrument = new InstrumentInfo(symbol);
      _timeframe = timeframe;
      _symbol = symbol;
   }
   ~ABaseCondition()
   {
      delete _instrument;
   }
};
#endif

#ifndef PriceStream_IMP
#define PriceStream_IMP

#ifndef AStream_IMP

interface IStream
{
public:
   virtual void AddRef() = 0;
   virtual void Release() = 0;

   virtual bool GetValue(const int period, double &val) = 0;
};

class AStream : public IStream
{
protected:
   string _symbol;
   ENUM_TIMEFRAMES _timeframe;
   double _shift;
   InstrumentInfo *_instrument;
   int _references;

   AStream(const string symbol, const ENUM_TIMEFRAMES timeframe)
   {
      _references = 1;
      _shift = 0.0;
      _symbol = symbol;
      _timeframe = timeframe;
      _instrument = new InstrumentInfo(_symbol);
   }

   ~AStream()
   {
      delete _instrument;
   }
public:
   void SetShift(const double shift)
   {
      _shift = shift;
   }

   void AddRef()
   {
      ++_references;
   }

   void Release()
   {
      --_references;
      if (_references == 0)
         delete &this;
   }
};
#define AStream_IMP
#endif
enum PriceType
{
   PriceClose = PRICE_CLOSE, // Close
   PriceOpen = PRICE_OPEN, // Open
   PriceHigh = PRICE_HIGH, // High
   PriceLow = PRICE_LOW, // Low
   PriceMedian = PRICE_MEDIAN, // Median
   PriceTypical = PRICE_TYPICAL, // Typical
   PriceWeighted = PRICE_WEIGHTED, // Weighted
   PriceMedianBody, // Median (body)
   PriceAverage, // Average
   PriceTrendBiased, // Trend biased
   PriceVolume, // Volume
};

class PriceStream : public AStream
{
   PriceType _price;
public:
   PriceStream(const string symbol, const ENUM_TIMEFRAMES timeframe, const PriceType __price)
      :AStream(symbol, timeframe)
   {
      _price = __price;
   }

   bool GetValue(const int period, double &val)
   {
      switch (_price)
      {
         case PriceClose:
            val = iClose(_symbol, _timeframe, period);
            break;
         case PriceOpen:
            val = iOpen(_symbol, _timeframe, period);
            break;
         case PriceHigh:
            val = iHigh(_symbol, _timeframe, period);
            break;
         case PriceLow:
            val = iLow(_symbol, _timeframe, period);
            break;
         case PriceMedian:
            val = (iHigh(_symbol, _timeframe, period) + iLow(_symbol, _timeframe, period)) / 2.0;
            break;
         case PriceTypical:
            val = (iHigh(_symbol, _timeframe, period) + iLow(_symbol, _timeframe, period) + iClose(_symbol, _timeframe, period)) / 3.0;
            break;
         case PriceWeighted:
            val = (iHigh(_symbol, _timeframe, period) + iLow(_symbol, _timeframe, period) + iClose(_symbol, _timeframe, period) * 2) / 4.0;
            break;
         case PriceMedianBody:
            val = (iOpen(_symbol, _timeframe, period) + iClose(_symbol, _timeframe, period)) / 2.0;
            break;
         case PriceAverage:
            val = (iHigh(_symbol, _timeframe, period) + iLow(_symbol, _timeframe, period) + iClose(_symbol, _timeframe, period) + iOpen(_symbol, _timeframe, period)) / 4.0;
            break;
         case PriceTrendBiased:
            {
               double close = iClose(_symbol, _timeframe, period);
               if (iOpen(_symbol, _timeframe, period) > iClose(_symbol, _timeframe, period))
                  val = (iHigh(_symbol, _timeframe, period) + close) / 2.0;
               else
                  val = (iLow(_symbol, _timeframe, period) + close) / 2.0;
            }
            break;
         case PriceVolume:
            val = (double)iVolume(_symbol, _timeframe, period);
            break;
      }
      val += _shift * _instrument.GetPipSize();
      return true;
   }
};
#endif

extern string   AlertsSection            = ""; // == Alerts ==
extern bool     popup_alert              = false; // Popup message
extern bool     notification_alert       = false; // Push notification
extern bool     email_alert              = false; // Email
extern bool     play_sound               = false; // Play sound on alert
extern string   sound_file               = ""; // Sound file
extern bool     start_program            = false; // Start external program
extern string   program_path             = ""; // Path to the external program executable
extern bool     advanced_alert           = false; // Advanced alert (Telegram/Discord/other platform (like another MT4))
extern string   advanced_key             = ""; // Advanced alert key
extern string   Comment2                 = "- You can get a key via @profit_robots_bot Telegram Bot. Visit ProfitRobots.com for discord/other platform keys -";
extern string   Comment3                 = "- Allow use of dll in the indicator parameters window -";
extern string   Comment4                 = "- Install AdvancedNotificationsLib.dll -";

#import "AdvancedNotificationsLib.dll"
void AdvancedAlert(string key, string text, string instrument, string timeframe);
#import
#import "shell32.dll"
int ShellExecuteW(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);
#impo

Показано первые 50% кода (символов: 15163)

Открыть по тарифу

Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.

Разовая покупка файла

На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.

Чтобы оформить заказ, введите email и перейдите к оплате.

Стоимость полного кода
1 516,30₽ ≈ $18.53