Группа "Стол заказов MQL"

Рейтинг 2088



РЕКОМЕНДУЮ



объединить индикаторы в один

Здравствуйте, просьба слить стандартные индикаторы в один.

Требуется кинуть индикатор на график и получить в итоге 4 Moving Average и 2 Envelopes.
В свойствах итогового индикатора необходимо разместить все настройки для каждого индикатора в одном.
для мувинга это:
-период
-сдвиг
-метод МА
-применить к:
-стиль линии

для Енвелопес:
-период
-сдвиг
-метод МА
-применить к:
-отклонение
-цвет верхней линии
-цвет нижней линии

Спасибо программистам за труд:) 

Envelopes.mq4 (2 Kb)

moving_averages.mq4 (5 Kb)
  • +2
  • Просмотров: 3090
  • 23 ноября 2016, 20:27
  • Enot-pipsun
Понравилcя материал? Не забудьте поставить плюс и поделиться в социальной сети!

Вступите в группу "Стол заказов MQL", чтобы следить за обновлениями
ПРИСОЕДИНИТЬСЯ К ГРУППЕ
присоединиться
  Предыдущая запись в группе
Советник для баланса
Следующая запись в группе  
дороботка сова
23 ноября 2016
24 ноября 2016

Комментарии (3)

+
0
Сегодня начну делать.
avatar

  34  AM2 Сообщений: 15882 - Андрей

  • 23 ноября 2016, 22:55
+
0
Готово: www.opentraders.ru/downloads/1394/




//+------------------------------------------------------------------+
//|                                                          4MA.mq4 |
//|                                              Copyright 2016, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, AM2"
#property link      "http://www.forexsystems.biz"
#property version   "1.00"
#property strict
#property indicator_chart_window

#property indicator_buffers 8

#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_color5 Blue
#property indicator_color6 Aqua
#property indicator_color7 Blue
#property indicator_color8 Aqua

#property indicator_style1 2
#property indicator_style2 2
#property indicator_style3 2
#property indicator_style4 2

input int MA1Period = 10;
input int MA2Period = 20;
input int MA3Period = 30;
input int MA4Period = 40;

input int MA1Shift = 0;
input int MA2Shift = 0;
input int MA3Shift = 0;
input int MA4Shift = 0;

input int MA1Method = 0;
input int MA2Method = 0;
input int MA3Method = 0;
input int MA4Method = 0;

input int MA1Price = 0;
input int MA2Price = 0;
input int MA3Price = 0;
input int MA4Price = 0;

input int EN1Period = 15;
input int EN2Period = 25;

input int EN1Method = 0;
input int EN2Method = 0;

input int EN1Shift = 0;
input int EN2Shift = 0;

input int EN1Price = 0;
input int EN2Price = 0;

input int EN1Mode = 0;
input int EN2Mode = 0;

input double EN1Dev = 0.2;
input double EN2Dev = 0.2;

double MA1Buffer[];
double MA2Buffer[];
double MA3Buffer[];
double MA4Buffer[];

double EN1UPBuffer[];
double EN2UPBuffer[];
double EN1DNBuffer[];
double EN2DNBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexStyle(6,DRAW_LINE);
   SetIndexStyle(7,DRAW_LINE);

   SetIndexBuffer(0,MA1Buffer);
   SetIndexBuffer(1,MA2Buffer);
   SetIndexBuffer(2,MA3Buffer);
   SetIndexBuffer(3,MA4Buffer);
   SetIndexBuffer(4,EN1UPBuffer);
   SetIndexBuffer(5,EN2UPBuffer);
   SetIndexBuffer(6,EN1DNBuffer);
   SetIndexBuffer(7,EN2DNBuffer);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
//---
   for(int i=0;i<=10000;i++)
     {
      MA1Buffer[i]=iMA(NULL,0,MA1Period,MA1Shift,MA1Method,MA1Price,i);
      MA2Buffer[i]=iMA(NULL,0,MA2Period,MA2Shift,MA2Method,MA2Price,i);
      MA3Buffer[i]=iMA(NULL,0,MA3Period,MA3Shift,MA3Method,MA3Price,i);
      MA4Buffer[i]=iMA(NULL,0,MA4Period,MA4Shift,MA4Method,MA4Price,i);

      EN1UPBuffer[i]=iEnvelopes(NULL,0,EN1Period,EN1Method,EN1Shift,EN1Price,EN1Dev,0,i);
      EN2UPBuffer[i]=iEnvelopes(NULL,0,EN2Period,EN2Method,EN2Shift,EN2Price,EN2Dev,0,i);

      EN1DNBuffer[i]=iEnvelopes(NULL,0,EN1Period,EN1Method,EN1Shift,EN1Price,EN1Dev,1,i);
      EN2DNBuffer[i]=iEnvelopes(NULL,0,EN2Period,EN2Method,EN2Shift,EN2Price,EN2Dev,1,i);
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+


Редактирован: 24 ноября 2016, 17:22
avatar

  34  AM2 Сообщений: 15882 - Андрей

  • 24 ноября 2016, 00:07
+
0
спасибо, я настрою входные параметры в коде.
как сделаю, отпишусь*hi* 
avatar

  12  Enot-pipsun Автор Сообщений: 292

  • 24 ноября 2016, 17:36

Зарегистрируйтесь или авторизуйтесь, чтобы оставить комментарий
Начать торговлю с Альпари