Прооблема с iMAOnArray(...)

 
есть вот такой вот код : \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ //+------------------------------------------------------------------+ //| RELS.mq4 | //| zzzz | //| 111 | //+------------------------------------------------------------------+ #property copyright "zzzz" #property link "111" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Red //---- input parameters extern int EMA_first=20; extern int EMA_second=3; extern int Plus_para=1; extern int Minus_para=1; //---- buffers double RELS[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,RELS); //---- short_name="RELS("+EMA_first+")"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //---- SetIndexDrawBegin(0, EMA_first); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int i,i_min,counted_bars=IndicatorCounted(); double ArrayY[]; //---- if(Bars=EMA_first) i=Bars-counted_bars-1; while(i>0) { i_min=i+1; //MomBuffer[i]=Close[i]*100/Close[i+MomPeriod]; ArrayY[i]=NormalizeDouble((iMA(NULL, 0, EMA_first, 0, 1, 5, i)-iMA(NULL, 0, EMA_first, 0, 1, 5, i_min))/(iMA(NULL, 0, EMA_first, 0, 1, 5, i)+iMA(NULL, 0, EMA_first, 0, 1, 5, i_min)),2); i--; } i=Bars-EMA_first-1; if(counted_bars>=EMA_first) i=Bars-counted_bars-1; while(i>0) { RELS[i] = iMAOnArray( ArrayY, 0, EMA_second, 0, 1, i); i--; } return(0); } //+------------------------------------------------------------------+ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ В итоге iMAOnArray() не работает !!! в чем может быть пречина
 
Пречина ф первую очирить ф том, што код ф таком виде бисполлитры нипаймёш.

Оформите его так, чтобы он нормально читался, и воспользуйтесь выпадающим списком -- Стили --.
 
А как код заклчить ??? [code] [/code] [mql] [/mql] [mql4] [/mql4] как???
 
у меня нет выпадаещего списка стили !!!
 
ar4i писал (а):
у меня нет выпадаещего списка стили !!!

Там где пишете в окошечко свои восклицания с восклицательными знаками - сверху панелька со значками. Там есть квадратик синий, а в нем буковки МQL - жмете на них - появляется еще окошечко - в него вставляете код и х'окей. И будет Вам щассье.
 
лови


//+------------------------------------------------------------------+
//|                                                     MTF_RELS.mq4 |
//|                                      Copyright © 2007, zzzzzzzzz |
//|                                                                  |
//+------------------------------------------------------------------+
 
 
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
 
//---- 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;     // ТФ в минутах, 0-текущий
extern int EMA_first          = 20;
extern int EMA_first_method     = 5;     // метод усреднения
extern int EMA_second         = 3;
extern int EMA_second_method    = 1;     // метод усреднения
extern int Normalize          = 4;     // NormalizeDouble, кол-во знаков после запятой
 
double ExtMapBuffer1[];
double ExtMapBuffer2[];
 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
 
int init()
  {
 
//---- indicator line
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(1,DRAW_NONE);
 
//---- 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("MTF_RELS("+EMA_first+", "+EMA_second+") ("+TimeFrameStr+")");
 
  }
//----
   return(0);
 
//+------------------------------------------------------------------+
//| MTF MA                                            |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();
 
// Plot defined time frame on to current time frame
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   
    limit=Bars-counted_bars+TimeFrame/Period();
   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 time frame
   Rule 3:  Use 'y' for your indicator's shift value
 **********************************************************/  
 
   ExtMapBuffer2[i] = NormalizeDouble((iMA(NULL, TimeFrame, EMA_first, 0, 1, EMA_first_method, y)-iMA(NULL, TimeFrame, EMA_first, 0, 1, EMA_first_method, y+1))/(iMA(NULL, TimeFrame, EMA_first, 0, 1, EMA_first_method, y)+iMA(NULL, TimeFrame, EMA_first, 0, 1, EMA_first_method, y+1)),Normalize);
   }  
   
   for(i=0,y=0;i<limit;i++)
   {
   ExtMapBuffer1[i] = iMAOnArray(ExtMapBuffer2,0,EMA_second,0,EMA_second_method,i);
   }   
 
     
//
   
  
  
   return(0);
  }
//+------------------------------------------------------------------+
 
Да все хорошо для IE а для Opera нет в ней вставить код ))) так что прощу обратить внимание !
 
sashken Фэнкс ) можно тогда тебе пару вопросов ! limit=Bars-counted_bars+TimeFrame/Period(); зачем в этой строчке TimeFrame/Period(); и for(i=0,y=0;ilimit;i++) { if (Time[i]TimeArray[y]) y++; ... } получается через один шаг у тебя в условие не входит и следовательно среднее значение через каждый 1 является предыдущем при чем он повторяется ! т.е. равен таму же числу !!!
 

Это сделано для того, чтобы индикатор показывал значения старших ТФ на младших ТФ, потому и переменная (y) шагает через шаг (если ТФ больше текущего). Открой этот индикатор, например, на ТФ М15, и введи значение TimeFrame = 60. Тогда думаю тебе станет все понятно:)