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

sentiment zone oscillator_2.mq5

Похожие материалы по тегам

#__slope direction line.mq5MQL5 / MetaTrader 5 · 1 общих теговrange breakout @meowforex1.pineTradingView · 1 общих тегов#1.mtf_collider_h4_close_13_v18bar.mq4MQL4 / MetaTrader 4 · 1 общих тегов!mth_fasttmaline_edit3.mq4MQL4 / MetaTrader 4 · 1 общих тегов!mth_fasttmaline_edit2.mq4MQL4 / MetaTrader 4 · 1 общих тегов!mth_fasttmaline_edit.mq4MQL4 / MetaTrader 4 · 1 общих тегов
Вы автор или правообладатель?

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

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

О программе

Индикатор «Sentiment Zone Oscillator» для MetaTrader 5 отображает осциллятор настроек в отдельном окне. Он определяет направление изменения цены (вверх/вниз/нейтрально), сглаживает выбранной методикой скользящей средней и строит график с динамическими уровнями (верхнее, среднее, нижнее) и заливкой между ними.

Поддерживается выбор цены из множества вариантов (Close, Open, High, Low, Median, Typical, Weighted, Average, а также цены Хейкин Аши). Доступны пять методов скользящей средней (SMA, EMA, SMMA, LWMA, TEMA) и два режима уровней — плавающие и квантильные.

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

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

НастройкаОписание
Time frame (TimeFrame) Таймфрейм — Таймфрейм для расчёта индикатора
Sentiment zone period (SzoPeriod) Период осциллятора — Период расчёта осциллятора
Sentiment zone calculating method (SzoMethod) Метод осциллятора — Метод скользящей средней для расчёта осциллятора
Price (Price) Тип цены — Тип цены для расчёта
Price filtering period (PriceFiltering) Период фильтрации цены — Период фильтрации цены
Price filtering method (PriceFilteringMethod) Метод фильтрации цены — Метод скользящей средней для фильтрации цены
Color change (ColorOn) Смена цвета — Режим смены цвета линии осциллятора
Level type (LevelType) Тип уровней — Тип уровней: плавающие или квантильные
Levels period (LevelPeriod) Период уровней — Период расчёта уровней
Up level % (LevelUp) Верхний уровень % — Процентное значение верхнего уровня
Down level % (LevelDown) Нижний уровень % — Процентное значение нижнего уровня
Turn alerts on? (AlertsOn) Алерты включены — Включение/выключение системы алертов
Alert on current bar? (AlertsOnCurrent) Алерт на текущем баре — Срабатывание алерта на текущем баре
Display messageas on alerts? (AlertsMessage) Всплывающие сообщения — Отображение всплывающего сообщения при алерте
Play sound on alerts? (AlertsSound) Звуковой сигнал — Воспроизведение звука при срабатывании алерта
Send email on alerts? (AlertsEmail) Email-уведомления — Отправка email-уведомлений при срабатывании алерта
Send push notification on alerts? (AlertsNotify) Push-уведомления — Отправка push-уведомлений при срабатывании алерта
Interpolate in multi time frame mode (Interpolate) Интерполяция — Интерполяция значений при работе на мультитаймфрейме
Получить полный код

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

???/*


*/

#property version   "1.00"

#property indicator_separate_window
#property indicator_height  120 
#property indicator_buffers 9
#property indicator_plots   5
#property indicator_label1  "Setiment zone oscillator levels"
#property indicator_type1   DRAW_FILLING
#property indicator_color1  C'0,233,233',C'233,0,233'

#property indicator_label2  "Setiment zone oscillator up level"
#property indicator_type2   DRAW_LINE
#property indicator_color2  C'0,144,0'
#property indicator_style2  STYLE_DOT
#property indicator_label3  "Setiment zone oscillator middle level"
#property indicator_type3   DRAW_LINE
#property indicator_color3  clrDimGray
#property indicator_style3  STYLE_DOT
#property indicator_label4  "Setiment zone oscillator down level"
#property indicator_type4   DRAW_LINE
#property indicator_color4  C'144,0,0'
#property indicator_style4  STYLE_DOT

#property indicator_label5  "Setiment zone oscillator"
#property indicator_type5   DRAW_COLOR_LINE
#property indicator_color5  clrDarkGray,C'0,233,233',C'233,0,233'
#property indicator_width5  2

enum enPrices
{
   pr_close,      // Close
   pr_open,       // Open
   pr_high,       // High
   pr_low,        // Low
   pr_median,     // Median
   pr_typical,    // Typical
   pr_weighted,   // Weighted
   pr_average,    // Average (high+low+open+close)/4
   pr_medianb,    // Average median body (open+close)/2
   pr_tbiased,    // Trend biased price
   pr_tbiased2,   // Trend biased (extreme) price
   pr_haclose,    // Heiken ashi close
   pr_haopen ,    // Heiken ashi open
   pr_hahigh,     // Heiken ashi high
   pr_halow,      // Heiken ashi low
   pr_hamedian,   // Heiken ashi median
   pr_hatypical,  // Heiken ashi typical
   pr_haweighted, // Heiken ashi weighted
   pr_haaverage,  // Heiken ashi average
   pr_hamedianb,  // Heiken ashi median body
   pr_hatbiased,  // Heiken ashi trend biased price
   pr_hatbiased2  // Heiken ashi trend biased (extreme) price
};
enum enMaTypes
{
   ma_sma,    // Simple moving average
   ma_ema,    // Exponential moving average
   ma_smma,   // Smoothed MA
   ma_lwma,   // Linear weighted MA
   ma_tema    // Tripple exponential moving average
};
enum enLevelType
{
   lvl_floa,  // Floating levels
   lvl_quan   // Quantile levels
};
enum enColorOn
{
   cc_onSlope,   // Change color on slope change
   cc_onMiddle,  // Change color on middle line cross
   cc_onLevels   // Change color on outer levels cross
};

input ENUM_TIMEFRAMES TimeFrame            = PERIOD_M15;     // Time frame
input int             SzoPeriod            = 13;             // Sentiment zone period
input enMaTypes       SzoMethod            = ma_ema;         // Sentiment zone calculating method
input enPrices        Price                = pr_close;       // Price
input int             PriceFiltering       = 34;             // Price filtering period
input enMaTypes       PriceFilteringMethod = ma_sma;         // Price filtering method
input enColorOn       ColorOn              = cc_onLevels;    // Color change
input enLevelType     LevelType            = lvl_quan;       // Level type
input int             LevelPeriod          = 30;             // Levels period
input double          LevelUp              = 95;             // Up level %
input double          LevelDown            = 5;              // Down level %
input bool            AlertsOn             = false;          // Turn alerts on?
input bool            AlertsOnCurrent      = false;          // Alert on current bar?
input bool            AlertsMessage        = true;           // Display messageas on alerts?
input bool            AlertsSound          = true;           // Play sound on alerts?
input bool            AlertsEmail          = false;          // Send email on alerts?
input bool            AlertsNotify         = false;          // Send push notification on alerts?
input bool            Interpolate          = true;           // Interpolate in multi time frame mode

double  fill1[],fill2[],val[],valc[],levelUp[],levelMi[],levelDn[],count[],state[],prices[];
string  _maNames[] = {"SMA","EMA","SMMA","LWMA","TEMA"};
int     _mtfHandle = INVALID_HANDLE; ENUM_TIMEFRAMES timeFrame;
#define _mtfCall iCustom(_Symbol,timeFrame,getIndicatorName(),PERIOD_CURRENT,SzoPeriod,SzoMethod,Price,PriceFiltering,PriceFilteringMethod,ColorOn,LevelType,LevelPeriod,LevelUp,LevelDown,AlertsOn,AlertsOnCurrent,AlertsMessage,AlertsSound,AlertsEmail,AlertsNotify)

int OnInit()
{
      // код доступен только после оплаты
   }

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
{
      // код доступен только после оплаты
   }
   if (Bars(_Symbol,_Period)<rates_total) return(-1);

      if (timeFrame!=_Period)
      {
         double result[]; datetime currTime[],nextTime[]; 
            if (!timeFrameCheck(timeFrame,time))         return(0);
            if (_mtfHandle==INVALID_HANDLE) _mtfHandle = _mtfCall;
            if (_mtfHandle==INVALID_HANDLE)              return(0);
            if (CopyBuffer(_mtfHandle,7,0,1,result)==-1) return(0); 

                #define _mtfRatio PeriodSeconds(timeFrame)/PeriodSeconds(_Period)
                int i,k,n,limit = MathMin(MathMax(prev_calculated-1,0),MathMax(rates_total-(int)result[0]*_mtfRatio-1,0));
                for (i=limit; i<rates_total && !_StopFlag; i++ )
                {
                  #define _mtfCopy(_buff,_buffNo) if (CopyBuffer(_mtfHandle,_buffNo,time[i],1,result)==-1) break; _buff[i] = result[0]
                          _mtfCopy(fill1   ,0);
                          _mtfCopy(fill2   ,1);
                          _mtfCopy(levelUp ,2);
                          _mtfCopy(levelMi ,3);
                          _mtfCopy(levelDn ,4);
                          _mtfCopy(val     ,5);
                          _mtfCopy(valc    ,6);

                          #define _mtfInterpolate(_buff) _buff[i-k] = _buff[i]+(_buff[i-n]-_buff[i])*k/n
                          if (!Interpolate) continue;  CopyTime(_Symbol,timeFrame,time[i  ],1,currTime); 
                              if (i<(rates_total-1)) { CopyTime(_Symbol,timeFrame,time[i+1],1,nextTime); if (currTime[0]==nextTime[0]) continue; }
                              for(n=1; (i-n)> 0 && time[i-n] >= currTime[0]; n++) continue;	
                              for(k=1; (i-k)>=0 && k<n; k++)
                              {
                                  _mtfInterpolate(fill1  );
                                  _mtfInterpolate(fill2  );
                                  _mtfInterpolate(levelUp);
                                  _mtfInterpolate(levelMi);
                                  _mtfInterpolate(levelDn);
                                  _mtfInterpolate(val    );
                              }                                 
                }
                return(i);
      }

   int levelPeriod = (LevelPeriod>1) ? LevelPeriod : SzoPeriod; 
   int i=(int)MathMax(prev_calculated-1,0); for (; i<rates_total && !_StopFlag; i++)
   {
      prices[i] = iCustomMa(PriceFilteringMethod,getPrice(Price,open,close,high,low,i,rates_total),PriceFiltering,i,rates_total,1);
      double useValue = (i>0) ? (prices[i]>prices[i-1]) ? 1 : (prices[i]<prices[i-1]) ? -1 : 0 : 0;

       val[i] = iCustomMa(SzoMethod,useValue,SzoPeriod,i,rates_total,0);

            switch (LevelType)
            {
               case lvl_floa :                     
                     {               
                        int    start = MathMax(i-levelPeriod+1,0);
                        double min   = val[ArrayMinimum(val,start,levelPeriod)];
                        double max   = val[ArrayMaximum(val,start,levelPeriod)];
                        double range = max-min;
                           levelUp[i] = min+LevelUp  *range/100.0;
                           levelDn[i] = min+LevelDown*range/100.0;
                           levelMi[i] = (levelUp[i]+levelDn[i])*0.5;
                           break;
                     }
               default :                                                
                     levelUp[i] = iQuantile(val[i],levelPeriod, LevelUp               ,i,rates_total);
                     levelDn[i] = iQuantile(val[i],levelPeriod, LevelDown             ,i,rates_total);
                     levelMi[i] = iQuantile(val[i],levelPeriod,(LevelUp+LevelDown)*0.5,i,rates_total);
                     break;
            }               
            switch(ColorOn)
            {
               case cc_onLevels: valc[i] = (val[i]>levelUp[i])  ? 1 : (val[i]<levelDn[i])  ? 2 : (val[i]>levelDn[i] && val[i]<levelUp[i]) ? 0 : (i>0) ? valc[i-1] : 0; break;
               case cc_onMiddle: valc[i] = (val[i]>levelMi[i])  ? 1 : (val[i]<levelMi[i])  ? 2 : 0; break;
               default :         valc[i] = (i>0) ? (val[i]>val[i-1]) ? 1 : (val[i]<val[i-1]) ? 2 : valc[i-1] : 0;
            }                  
            fill2[i] = (val[i]>levelUp[i]) ? levelUp[i] : (val[i]<levelDn[i]) ? levelDn[i] : val[i];
            fill1[i] = val[i];
   }
   count[rates_total-1] = Mat

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

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

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

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

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

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

Стоимость полного кода
1 456,50₽ ≈ $17.80