не работает индикатор в mt4 - страница 2

 
richard13:

я не сильно в этом разбираюсь, помогите пожалуйста подробнее что такое стрикт и что именно убрать, и что нужно исправить в приведенном вами коде.

Заранее спасибо 

В начале есть строка: #property strict Так закомментируйте её! Вот так: //#property strict И не будет Вам козни строить! С Новым Годом!


 

С Новым годом!

Я заменил как вы указали, индикатор на график ставиться но пустой

 2016.01.02 10:13:08.394 3color_MACD USDCHF,H4: initialized

выкладываю код
 

Еще вот это

if(!SetIndexBuffer(0,ind_buffer1) &&
      !SetIndexBuffer(1,ind_buffer2) &&
      !SetIndexBuffer(2,ind_buffer3) &&
      !SetIndexBuffer(3,ind_buffer4) &&
      !SetIndexBuffer(4,ind_buffer5))
       Print("cannot set indicator buffers!");

 Заменить на

SetIndexBuffer(0,ind_buffer1);
SetIndexBuffer(1,ind_buffer2);
SetIndexBuffer(2,ind_buffer3);
SetIndexBuffer(3,ind_buffer4);
SetIndexBuffer(4,ind_buffer5);
      
 

//+------------------------------------------------------------------+
//|                                                  3color_MACD.mq4 |
//|               MACD:  Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//|             3color:  Copyright © 2005,          Nikolay Kositsin |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2004, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
//#property strict
#property  indicator_buffers 5
#property  indicator_color1  MediumBlue
#property  indicator_color2  Red
#property  indicator_color3  Gray
#property  indicator_color4  LimeGreen
#property  indicator_color5  DarkSlateBlue
//---- indicator parameters
extern int FastEMA=5;
extern int SlowEMA=34;
extern int SignalSMA=5;
extern int CountBars=300;
extern int Line=3;
//---- indicator buffers
double     ind_buffer1[];
double     ind_buffer2[];
double     ind_buffer3[];
double     ind_buffer4[];
double     ind_buffer5[];

double minuse;
double Vol;
double Zml;
double Color1;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  
//---- indicator buffers mapping
   IndicatorBuffers(5);
   SetIndexBuffer(0,ind_buffer1);
SetIndexBuffer(1,ind_buffer2);
SetIndexBuffer(2,ind_buffer3);
SetIndexBuffer(3,ind_buffer4);
SetIndexBuffer(4,ind_buffer5);
//---- drawing settings
    
   Color1= C'128,0,255';                                            
   SetIndexStyle(0,DRAW_HISTOGRAM, STYLE_SOLID, 2, Color1); 
   SetIndexStyle(1,DRAW_HISTOGRAM, STYLE_SOLID, 2);
   SetIndexStyle(2,DRAW_HISTOGRAM, STYLE_SOLID, 3);
   SetIndexStyle(3,DRAW_LINE, STYLE_DASHDOTDOT,1);   

   SetIndexDrawBegin(0,Bars-CountBars);
   SetIndexDrawBegin(1,Bars-CountBars);
   SetIndexDrawBegin(2,Bars-CountBars);
   SetIndexDrawBegin(3,Bars-CountBars+SignalSMA); 
     
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);

//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
   SetIndexLabel(0,"MACDUp");
   SetIndexLabel(1,"MACDDown");
   SetIndexLabel(2,"MACDStr");
   SetIndexLabel(3,"Signal");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()   
   {
//---- drawing settings
   int limit;  
   int counted_bars=IndicatorCounted(); 
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
   
   for(int i=0; i<limit; i++)      
   
      ind_buffer5[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);      
      
//---- Three Colour MACD mapping 
     for(i=0; i<limit; i++)
   {          
       Vol = ind_buffer5[i];     minuse = Vol - ind_buffer5[i+1];  
     
           if(minuse>0.0){ind_buffer1[i]=Vol; ind_buffer2[i]=0.0; ind_buffer3[i]=0.0;} 
     else {if(minuse<0.0){ind_buffer1[i]=0.0; ind_buffer2[i]=Vol; ind_buffer3[i]=0.0;}
     else                {ind_buffer1[i]=0.0; ind_buffer2[i]=0.0; ind_buffer3[i]=Vol;}} 
 //---- 
   } 
        
//---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
      ind_buffer4[i]=iMAOnArray(ind_buffer5,Bars,SignalSMA,0,MODE_SMA,i);
//---- done
   return(0);
  }

Все также пустое окно индикатора 

2016.01.03 11:00:14.101 3color_MACD USDCHF,H4: initialized

 
richard13:

Все также пустое окно индикатора 

2016.01.03 11:00:14.101 3color_MACD USDCHF,H4: initialized

Работает.  Наверно забыли нажать кнопку "Компилировать".
 

Работает, спасибо. 

Остальные индикаторы тоже необходимо также редактировать? 

 
richard13:

Работает, спасибо. 

Остальные индикаторы тоже необходимо также редактировать? 

Не. Каждый по своему.
 
Dmitry Fedoseev:
Не. Каждый по своему.

спасибо с Рождеством!

 

У меня такая же проблема, но с другим индикатором - MTF Supertrend. После обновления МТ4 перестал работать. Выдает ошибку -- 2016.06.13 14:55:35.930    cannot open file 'C:\Users\EVEREST-12\AppData\Roaming\MetaQuotes\Terminal\B26418DA5CE2882E449D85C103BE5AB3\MQL4\indicators\Supertrend.ex4' [2].

Код индикатора:

//+------------------------------------------------------------------+
//|                                              #MTF_Supertrend.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Jason Robinson (jnrtrading)."
#property link      "http://www.jnrtrading.co.uk"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red

//---- input parameters
/*************************************************************************
PERIOD_M1   1
PERIOD_M5   5
PERIOD_M15  15
PERIOD_M30  30 
PERIOD_H1   60
PERIOD_H4   240
PERIOD_D1   1440
PERIOD_W1   10080
PERIOD_MN1  43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------
PRICE_CLOSE    0 Close price. 
PRICE_OPEN     1 Open price. 
PRICE_HIGH     2 High price. 
PRICE_LOW      3 Low price. 
PRICE_MEDIAN   4 Median price, (high+low)/2. 
PRICE_TYPICAL  5 Typical price, (high+low+close)/3. 
PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4. 
You must use the numeric value of the Applied Price that you want to use
when you set the 'applied_price' value with the indicator inputs.
**************************************************************************/

extern int TimeFrame=0;
double TrendUp[];
double TrendDown[];
int st = 0;
//extern int SlowerEMA = 6;

double ExtMapBuffer1[];
double ExtMapBuffer2[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators

   SetIndexStyle(0, DRAW_LINE, 1,2);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexStyle(1, DRAW_LINE, 1,2);
   SetIndexBuffer(1, ExtMapBuffer2);
   
   /*SetIndexStyle(0, DRAW_ARROW, EMPTY);
   SetIndexArrow(0, 159);
   SetIndexBuffer(0, TrendUp);
   SetIndexStyle(1, DRAW_ARROW, EMPTY);
   SetIndexArrow(1, 159);
   SetIndexBuffer(1, TrendDown);*/
   
   /*for(int i = 0; i < Bars; i++) {
      TrendUp[i] = NULL;
      TrendDown[i] = NULL;
   }*/
   //---- name for DataWindow and indicator subwindow label   
   switch(TimeFrame)
   {
      case 1 : string TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current Timeframe";
   }
   IndicatorShortName("Supertrend("+st+") ("+TimeFrameStr+")");

return(0);

  }
   
  
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   /*for(int i = 0; i < Bars; i++) {
      TrendUp[i] = NULL;
      TrendDown[i] = NULL;
   }*/
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,shift,limit,y=0,counted_bars=IndicatorCounted();
    
// Plot defined timeframe on to current timeframe   
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   
   limit=Bars-counted_bars;
   for(i=0,y=0;i<limit;i++)
   {
   if (Time[i]<TimeArray[y]) y++; 
   
 /***********************************************************   
   Add your main indicator loop below.  You can reference an existing
      indicator with its iName  or iCustom.
   Rule 1:  Add extern inputs above for all neccesary values   
   Rule 2:  Use 'TimeFrame' for the indicator timeframe
   Rule 3:  Use 'y' for the indicator's shift value
 **********************************************************/  
 
 ExtMapBuffer1[i]=iCustom(NULL,TimeFrame,"Supertrend",0,y);
 ExtMapBuffer2[i]=iCustom(NULL,TimeFrame,"Supertrend",1,y);
  } 
//----
   return(0);
  }

//+------------------------------------------------------------------+


Если сможете помочь - буду очень признателен.

Торговая платформа MetaTrader 5 для организации брокерского обслуживания / MetaQuotes Software Corp.
  • www.metaquotes.net
Торговая платформа MetaTrader 5 предназначена для проведения торговых операций на различных финансовый рынках. Терминал обладает большой базой аналитических возможностей и поддерживает более 70 различных инструментов для выполнения технического анализа
 
shyshkovskyy:

У меня такая же проблема, но с другим индикатором - MTF Supertrend. После обновления МТ4 перестал работать. Выдает ошибку -- 2016.06.13 14:55:35.930    cannot open file 'C:\Users\EVEREST-12\AppData\Roaming\MetaQuotes\Terminal\B26418DA5CE2882E449D85C103BE5AB3\MQL4\indicators\Supertrend.ex4' [2].

У вас этот исходник компилируется без ошибок? По указанному пути после компиляции реально лежит свежий файл Supertrend.ex4?