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

ma ribbon (cci 2 levels) bt.mq5

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

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

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

О программе

Индикатор для MetaTrader 4, отображающий ленту из 20 скользящих средних с последовательным увеличением периода. Видимость линий ленты управляется индикатором CCI: при превышении верхнего порога используется одна пара буферов для построения, при падении ниже нижнего порога — другая. Это позволяет визуально выделять участки графика, где CCI находится в заданных зонах. На графике размещается кнопка для включения и выключения отображения ленты.

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

НастройкаОписание
MAPeriod Период MA — Базовый период для расчёта скользящих средних; остальные линии ленты строятся с шагом +2 от этого значения.
MAMethod Метод MA — Метод расчёта скользящей средней (например, EMA, SMA и др.).
MAPriceType Тип цены MA — Тип цены, используемый для расчёта скользящих средних.
MAShift Сдвиг MA — Горизонтальный сдвиг линий скользящей средней в барах.
noteStochastic Разделитель CCI — Текстовая метка-разделитель в настройках, обозначающая группу параметров CCI.
Cciperiod Период CCI — Период расчёта индикатора Commodity Channel Index, используемого для управления видимостью ленты.
Price Тип цены CCI — Тип цены, применяемый при расчёте CCI.
Levelup Верхний уровень CCI — Пороговое значение CCI, при превышении которого лента строится одной парой буферов.
Leveldown Нижний уровень CCI — Пороговое значение CCI, при падении ниже которого лента строится другой парой буферов.
button_note1 Разделитель кнопки 1 — Текстовая метка-разделитель перед группой настроек кнопки.
btn_Subwindow Подокно кнопки — Индекс подокна графика, в котором размещается кнопка (0 — главное окно).
chart btn_corner for anchoring (btn_corner) Угол привязки кнопки — Угол графика, от которого привязывается позиция кнопки.
btn_text Текст кнопки — Надпись, отображаемая на кнопке переключения видимости ленты.
btn_Font Шрифт кнопки — Шрифт, используемый для текста кнопки.
btn__font size (btn_FontSize) Размер шрифта кнопки — Размер шрифта текста кнопки.
btn_text_ON_color Цвет текста кнопки (вкл) — Цвет текста кнопки при включённом отображении ленты.
btn_text_OFF_color Цвет текста кнопки (выкл) — Цвет текста кнопки при выключенном отображении ленты.
btn_background_color Фон кнопки — Цвет фона кнопки.
btn_border_color Граница кнопки — Цвет границы (рамки) кнопки.
btn__x (button_x) X координата кнопки — Горизонтальное смещение кнопки от указанного угла привязки в пикселях.
btn__y (button_y) Y координата кнопки — Вертикальное смещение кнопки от указанного угла привязки в пикселях.
btn__width (btn_Width) Ширина кнопки — Ширина кнопки в пикселях.
btn__height (btn_Height) Высота кнопки — Высота кнопки в пикселях.
UniqueButtonID Уникальный ID кнопки — Уникальный идентификатор, используемый для генерации имени объекта кнопки.
button_note2 Разделитель кнопки 2 — Текстовая метка-разделитель после группы настроек кнопки.
Получить полный код

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

???//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 100
#property indicator_color1 clrLightGray
#property indicator_color2 clrLime
#property indicator_color3 clrLime
#property indicator_color4 clrRed
#property indicator_color5 clrRed

#property indicator_color6 clrLightGray
#property indicator_color7 clrLime
#property indicator_color8 clrLime
#property indicator_color9 clrRed
#property indicator_color10 clrRed

#property indicator_color11 clrLightGray
#property indicator_color12 clrLime
#property indicator_color13 clrLime
#property indicator_color14 clrRed
#property indicator_color15 clrRed

#property indicator_color16 clrLightGray
#property indicator_color17 clrLime
#property indicator_color18 clrLime
#property indicator_color19 clrRed
#property indicator_color20 clrRed

#property indicator_color21 clrLightGray
#property indicator_color22 clrLime
#property indicator_color23 clrLime
#property indicator_color24 clrRed
#property indicator_color25 clrRed

#property indicator_color26 clrLightGray
#property indicator_color27 clrLime
#property indicator_color28 clrLime
#property indicator_color29 clrRed
#property indicator_color30 clrRed

#property indicator_color31 clrLightGray
#property indicator_color32 clrLime
#property indicator_color33 clrLime
#property indicator_color34 clrRed
#property indicator_color35 clrRed

#property indicator_color36 clrLightGray
#property indicator_color37 clrLime
#property indicator_color38 clrLime
#property indicator_color39 clrRed
#property indicator_color40 clrRed

#property indicator_color41 clrLightGray
#property indicator_color42 clrLime
#property indicator_color43 clrLime
#property indicator_color44 clrRed
#property indicator_color45 clrRed

#property indicator_color46 clrLightGray
#property indicator_color47 clrLime
#property indicator_color48 clrLime
#property indicator_color49 clrRed
#property indicator_color50 clrRed

#property indicator_color51 clrLightGray
#property indicator_color52 clrLime
#property indicator_color53 clrLime
#property indicator_color54 clrRed
#property indicator_color55 clrRed

#property indicator_color56 clrLightGray
#property indicator_color57 clrLime
#property indicator_color58 clrLime
#property indicator_color59 clrRed
#property indicator_color60 clrRed

#property indicator_color61 clrLightGray
#property indicator_color62 clrLime
#property indicator_color63 clrLime
#property indicator_color64 clrRed
#property indicator_color65 clrRed

#property indicator_color66 clrLightGray
#property indicator_color67 clrLime
#property indicator_color68 clrLime
#property indicator_color69 clrRed
#property indicator_color70 clrRed

#property indicator_color71 clrLightGray
#property indicator_color72 clrLime
#property indicator_color73 clrLime
#property indicator_color74 clrRed
#property indicator_color75 clrRed

#property indicator_color76 clrLightGray
#property indicator_color77 clrLime
#property indicator_color78 clrLime
#property indicator_color79 clrRed
#property indicator_color80 clrRed

#property indicator_color81 clrLightGray
#property indicator_color82 clrLime
#property indicator_color83 clrLime
#property indicator_color84 clrRed
#property indicator_color85 clrRed

#property indicator_color86 clrLightGray
#property indicator_color87 clrLime
#property indicator_color88 clrLime
#property indicator_color89 clrRed
#property indicator_color90 clrRed

#property indicator_color91 clrLightGray
#property indicator_color92 clrLime
#property indicator_color93 clrLime
#property indicator_color94 clrRed
#property indicator_color95 clrRed

#property indicator_color96 clrLightGray
#property indicator_color97 clrLime
#property indicator_color98 clrLime
#property indicator_color99 clrRed
#property indicator_color100 clrRed

extern int                 MAPeriod              = 13;
extern ENUM_MA_METHOD      MAMethod              = MODE_EMA;
extern ENUM_APPLIED_PRICE  MAPriceType           = PRICE_CLOSE;
extern int                 MAShift               = 0;
extern string              noteStochastic        ="-----CCI----------------------";
extern int                 Cciperiod             = 24;
extern ENUM_APPLIED_PRICE  Price                 = PRICE_TYPICAL;
extern int                 Levelup               = 100;
extern int                 Leveldown             =-100;

extern string              button_note1          = "------------------------------";
extern int                 btn_Subwindow         = 0;
extern ENUM_BASE_CORNER    btn_corner            = CORNER_LEFT_UPPER;                 // chart btn_corner for anchoring
extern string              btn_text              = "MA CCI";
extern string              btn_Font              = "Arial";
extern int                 btn_FontSize          = 9;                                 //btn__font size
extern color               btn_text_ON_color     = clrLime;
extern color               btn_text_OFF_color    = clrRed;
extern color               btn_background_color  = clrDimGray;
extern color               btn_border_color      = clrBlack;
extern int                 button_x              = 20;                                //btn__x
extern int                 button_y              = 13;                                //btn__y
extern int                 btn_Width             = 60;                                //btn__width
extern int                 btn_Height            = 20;                                //btn__height
extern string              UniqueButtonID        = "MAribbonCCI";
extern string              button_note2          = "------------------------------";
bool                       show_data             = true;
string IndicatorName, IndicatorObjPrefix;

double MovingAverage01[], ExtMapBuffer2[], ExtMapBuffer3[], ExtMapBuffer4[], ExtMapBuffer5[];
double MovingAverage02[], ExtMapBuffer7[], ExtMapBuffer8[], ExtMapBuffer9[], ExtMapBuffer10[];
double MovingAverage03[], ExtMapBuffer12[], ExtMapBuffer13[], ExtMapBuffer14[], ExtMapBuffer15[];
double MovingAverage04[], ExtMapBuffer17[], ExtMapBuffer18[], ExtMapBuffer19[], ExtMapBuffer20[];
double MovingAverage05[], ExtMapBuffer22[], ExtMapBuffer23[], ExtMapBuffer24[], ExtMapBuffer25[];

double MovingAverage06[], ExtMapBuffer27[], ExtMapBuffer28[], ExtMapBuffer29[], ExtMapBuffer30[];
double MovingAverage07[], ExtMapBuffer32[], ExtMapBuffer33[], ExtMapBuffer34[], ExtMapBuffer35[];
double MovingAverage08[], ExtMapBuffer37[], ExtMapBuffer38[], ExtMapBuffer39[], ExtMapBuffer40[];
double MovingAverage09[], ExtMapBuffer42[], ExtMapBuffer43[], ExtMapBuffer44[], ExtMapBuffer45[];
double MovingAverage10[], ExtMapBuffer47[], ExtMapBuffer48[], ExtMapBuffer49[], ExtMapBuffer50[];

double MovingAverage11[], ExtMapBuffer52[], ExtMapBuffer53[], ExtMapBuffer54[], ExtMapBuffer55[];
double MovingAverage12[], ExtMapBuffer57[], ExtMapBuffer58[], ExtMapBuffer59[], ExtMapBuffer60[];
double MovingAverage13[], ExtMapBuffer62[], ExtMapBuffer63[], ExtMapBuffer64[], ExtMapBuffer65[];
double MovingAverage14[], ExtMapBuffer67[], ExtMapBuffer68[], ExtMapBuffer69[], ExtMapBuffer70[];
double MovingAverage15[], ExtMapBuffer72[], ExtMapBuffer73[], ExtMapBuffer74[], ExtMapBuffer75[];

double MovingAverage16[], ExtMapBuffer77[], ExtMapBuffer78[], ExtMapBuffer79[], ExtMapBuffer80[];
double MovingAverage17[], ExtMapBuffer82[], ExtMapBuffer83[], ExtMapBuffer84[], ExtMapBuffer85[];
double MovingAverage18[], ExtMapBuffer87[], ExtMapBuffer88[], ExtMapBuffer89[], ExtMapBuffer90[];
double MovingAverage19[], ExtMapBuffer92[], ExtMapBuffer93[], ExtMapBuffer94[], ExtMapBuffer95[];
double MovingAverage20[], ExtMapBuffer97[], ExtMapBuffer98[], ExtMapBuffer99[], ExtMapBuffer100[];

string GenerateIndicatorName(const string target) //don't change anything here
{
   string name = target;
   int try = 2;
   while (WindowFind(name) != -1)
   {
      name = target + " #" + IntegerToString(try++);
   }
   return name;
}

string buttonId;

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

void createButton(string buttonID,string buttonText,int width,int height,string font,int fontSize,color bgColor,color borderColor,color txtColor)
{
      ObjectDelete    (ChartID(),buttonID);
      ObjectCreate    (ChartID(),buttonID,OBJ_BUTTON,btn_Subwindow,0,0);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_COLOR,txtColor);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_BGCOLOR,bgColor);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_BORDER_COLOR,borderColor);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_XSIZE,width);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_YSIZE,height);
      ObjectSetString (ChartID(),buttonID,OBJPROP_FONT,font);
      ObjectSetString (ChartID(),buttonID,OBJPROP_TEXT,buttonText);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_FONTSIZE,fontSize);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_SELECTABLE,0);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_CORNER,btn_corner);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_HIDDEN,1);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_XDISTANCE,9999);
      ObjectSetInteger(ChartID(),buttonID,OBJPROP_YDISTANCE,9999);
}

int deinit()
{
   ObjectsDeleteAll(ChartID(), IndicatorObjPrefix);

	return(0);
}

bool recalc = true;

void handleButtonClicks()
{
   if (ObjectGetInteger(ChartID(), buttonId, OBJPROP_STATE))
   {
      ObjectSetInteger(ChartID(), buttonId, OBJPROP_STATE, false);
      show_data = !show_data;
      GlobalVariableSet(IndicatorName + "_visibility", show_data ? 1.0 : 0.0);
      recalc = true;
      start();
   }
}

void OnChartEvent(const int id, //don't change anything here in this function
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
   handleButtonClicks();   
}

int init2()
{
   SetIndexBuffer(0,MovingAverage01);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexBuffer(5,MovingAverage02);
   SetIndexBuffer(6,ExtMapBuffer7);
   SetIndexBuffer(7,ExtMapBuffer8);
   SetIndexBuffer(8,ExtMapBuffer9);
   SetIndexBuffer(9,ExtMapBuffer10);
   SetIndexBuffer(10,MovingAverage03);
   SetIndexBuffer(11,ExtMapBuffer12);
   SetIndexBuffer(12,ExtMapBuffer13);
   SetIndexBuffer(13,ExtMapBuffer14);
   SetIndexBuffer(14,ExtMapBuffer15);
   SetIndexBuffer(15,MovingAverage04);
   SetIndexBuffer(16,ExtMapBuffer17);
   SetIndexBuffer(17,ExtMapBuffer18);
   SetIndexBuffer(18,ExtMapBuffer19);
   SetIndexBuffer(19,ExtMapBuffer20);
   SetIndexBuffer(20,MovingAverage05);
   SetIndexBuffer(21,ExtMapBuffer22);
   SetIndexBuffer(22,ExtMapBuffer23);
   SetIndexBuffer(23,ExtMapBuffer24);
   SetIndexBuffer(24,ExtMapBuffer25);

   SetIndexBuffer(25,MovingAverage06);
   SetIndexBuffer(26,ExtMapBuffer27);
   SetIndexBuffer(27,ExtMapBuffer28);
   SetIndexBuffer(28,ExtMapBuffer29);
   SetIndexBuffer(29,ExtMapBuffer30);
   SetIndexBuffer(30,MovingAverage07);
   SetIndexBuffer(31,ExtMapBuffer32);
   SetIndexBuffer(32,ExtMapBuffer33);
   SetIndexBuffer(33,ExtMapBuffer34);
   SetIndexBuffer(34,ExtMapBuffer35);
   SetIndexBuffer(35,MovingAverage08);
   SetIndexBuffer(36,ExtMapBuffer37);
   SetIndexBuffer(37,ExtMapBuffer38);
   SetIndexBuffer(38,ExtMapBuffer39);
   SetIndexBuffer(39,ExtMapBuffer40);
   SetIndexBuffer(40,MovingAverage09);
   SetIndexBuffer(41,ExtMapBuffer42);
   SetIndexBuffer(42,ExtMapBuffer43);
   SetIndexBuffer(43,ExtMapBuffer44);
   SetIndexBuffer(44,ExtMapBuffer45);
   SetIndexBuffer(45,MovingAverage10);
   SetIndexBuffer(46,ExtMapBuffer47);
   SetIndexBuffer(47,ExtMapBuffer48);
   Set

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

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

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

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

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

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

Стоимость полного кода
1 941,80₽ ≈ $23.73