ruslan71
Руслан

 
Уровень 21

  Торгую в компаниях:


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

Рейтинг 2087



РЕКОМЕНДУЮ



МАКДИ
[*]

Здрасвуйте Андрей сделайте пожалуйста чтобы индикатор установленный мт4 по умолчанию МАКДИ MACD.ex4 (8 Kb) MACD.mq4 (3 Kb) мог изменять свет как вот этот макдиMACD_MA.ex4 (10 Kb) MACD_MA.mq4 (4 Kb)
  • +1
  • Просмотров: 1930
  • 13 сентября 2016, 16:14
  • ruslan71
Понравилcя материал? Не забудьте поставить плюс и поделиться в социальной сети!

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

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

+
0
А чем не устраивает цветной макди ма? Там достаточно поменять цвет в настройках и будет как у вас на скрине.


#property  indicator_color1  Blue
#property  indicator_color2  Green
#property  indicator_color3  Red


avatar

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

  • 14 сентября 2016, 01:25
+
0
avatar

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

  • 14 сентября 2016, 02:22
+
0
Спасибо Андрей я запускал мтэшный и цветной все же тот что стоит по умолчанию более точный и в цветном нет сигнальной линии
avatar

  21  ruslan71 Автор Сообщений: 974 - Руслан

  • 14 сентября 2016, 09:09
+
0
Вы сможете сделать чтобы рисовал именно тот что стоит по умолчанию?
avatar

  21  ruslan71 Автор Сообщений: 974 - Руслан

  • 14 сентября 2016, 09:10
+
0
Посмотрю вечером.
avatar

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

  • 14 сентября 2016, 12:17
+
0
Примерно так: www.opentraders.ru/downloads/1316/



//+------------------------------------------------------------------+
//|                                                     MACD_MOD.mq4 |
//|                                              Copyright 2016, AM2 |
//|                                      http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, AM2"
#property link      "http://www.forexsystems.biz"
#property description "Moving Averages Convergence/Divergence"
#property strict

#include <MovingAverages.mqh>

//--- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 4
#property  indicator_color1  Red
#property  indicator_color2  Blue
#property  indicator_color3  clrNONE
#property  indicator_color4  Red
#property  indicator_width1  2
#property  indicator_width2  2
#property  indicator_width3  1
#property  indicator_width4  1
//--- indicator parameters
input int InpFastEMA=12;   // Fast EMA Period
input int InpSlowEMA=26;   // Slow EMA Period
input int InpSignalSMA=9;  // Signal SMA Period
//--- indicator buffers
double    MRed[];
double    MBlue[];
double    Macd[];
double    MSig[];
//--- right input parameters flag
bool      ExtParameters=true;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
  {
   IndicatorDigits(Digits+1);
//--- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexStyle(3,DRAW_LINE);
//--- indicator buffers mapping
   SetIndexBuffer(0,MRed);
   SetIndexBuffer(1,MBlue);
   SetIndexBuffer(2,Macd);
   SetIndexBuffer(3,MSig);
//--- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD_MOD("+IntegerToString(InpFastEMA)+","+IntegerToString(InpSlowEMA)+","+IntegerToString(InpSignalSMA)+")");
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"MACD");
   SetIndexLabel(2,"MACD");
   SetIndexLabel(3,"Signal");
//--- check for input parameters
   if(InpFastEMA<=1 || InpSlowEMA<=1 || InpSignalSMA<=1 || InpFastEMA>=InpSlowEMA)
     {
      Print("Wrong input parameters");
      ExtParameters=false;
      return(INIT_FAILED);
     }
   else
      ExtParameters=true;
//--- initialization done
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
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[])
  {
   int i,limit;
//---
   if(rates_total<=InpSignalSMA || !ExtParameters)
      return(0);
//--- last counted bar will be recounted
   limit=rates_total-prev_calculated;
   if(prev_calculated>0)
      limit++;
//--- macd counted in the 1-st buffer
   for(i=0; i<limit; i++)
     {
      double macd=iMA(NULL,0,InpFastEMA,0,1,0,i)-iMA(NULL,0,InpSlowEMA,0,1,0,i);
      double macd1=iMA(NULL,0,InpFastEMA,0,1,0,i+1)-iMA(NULL,0,InpSlowEMA,0,1,0,i+1);
      
      Macd[i]=macd;

      if(macd>macd1 && macd>0) MRed[i]=macd;
      if(macd<macd1 && macd>0) MBlue[i]=macd;

      if(macd>macd1 && macd<0) MRed[i]=macd;
      if(macd<macd1 && macd<0) MBlue[i]=macd;
     }
//--- signal line counted in the 2-nd buffer
   SimpleMAOnBuffer(rates_total,prev_calculated,0,InpSignalSMA,Macd,MSig);
//--- done
   return(rates_total);
  }
//+------------------------------------------------------------------+

Редактирован: 15 сентября 2016, 09:27
avatar

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

  • 14 сентября 2016, 12:44
+
0
Спасибо проверю
avatar

  21  ruslan71 Автор Сообщений: 974 - Руслан

  • 14 сентября 2016, 15:13

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