Сравнение Highest() в МТ3 и Highest() в МТ4

 
Здравствуте, коллеги программисты, тейдеры-программисты и просто трейдеры!!!
Но вопрос у меня прежде всего к разработчикам.
В одном из индикаторов, в МТ3 была такая конструкция:

SsMax = High[Highest(MODE_HIGH,shift+SSP-1,SSP)];
SsMin = Low[Lowest(MODE_LOW,shift+SSP-1,SSP)];

Я переписал её для МТ4:

SsMax = High[Highest(NULL,0,MODE_HIGH,SSP,i+SSP-1)];
SsMin = Low[Lowest(NULL,0,MODE_LOW,SSP,i+SSP-1)];

Результат получается абсолютно другой.
Где я ошибся? Или функции Highest && Lowest глючат? На всякий случай вот код индикаторы в МТ 3 и МТ 4

Метатрейдер 3

/*[[
Name := SilverTrend
Author := Copyright © 2003, VIAC.RU AlexSilver,OlegVS,GOODMAN
Link := http://viac.ru/
Separate Window := No
First Color := Red
First Draw Type := Histogram
Use Second Data := Yes
Second Color := Blue
Second Draw Type := Histogram
Second Symbol := 218
]]*/
Inputs : RISK(3),CountBars(300),SSP(9);
Variables : firstTime(True),shift(0), loopbegin(0);
Variables : smin(0), smax(0), SsMax(0), SsMin(0) ,K(0),val1(0),val2(0);

//SetLoopCount(0);

K=33-RISK;
If firstTime then
{
loopbegin = CountBars;
If loopbegin>(Bars-2*SSP+1) Then loopbegin=Bars-2*SSP+1;
firstTime=False;
};
For shift = loopbegin DownTo 0 Begin
SsMax = High[Highest(MODE_HIGH,shift+SSP-1,SSP)];
SsMin = Low[Lowest(MODE_LOW,shift+SSP-1,SSP)];
smin = SsMin+(SsMax-SsMin)*K/100;
smax = SsMax-(SsMax-SsMin)*K/100;
val1=0;
val2=0;
If C[shift]<smin Then
{val1=High[shift];
val2=Low[shift];
};
If C[shift]>smax Then
{val2=High[shift];
val1=Low[shift];
};

SetIndexValue(shift,val1);
SetIndexValue2(shift,val2);
If shift>0 then loopbegin=loopbegin-1;
End;


Метатрейдер 4

//+------------------------------------------------------------------+
//|                                                 SilverTrend .mq4 |
//|                             SilverTrend  rewritten by CrazyChart |
//|                                                 http://viac.ru/  |
//+------------------------------------------------------------------+
#property copyright "SilverTrend  rewritten by CrazyChart"
#property link      "http://viac.ru/ "

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- input parameters
extern int       RISK=3;
extern int       CountBars=300;
extern int       SSP=9;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_HISTOGRAM,1,1,Red);
   SetIndexBuffer(0,ExtMapBuffer1);
   //SetIndexLabel(0,"fffff");
  // SetIndexArrow(1,218);
   SetIndexStyle(1,DRAW_HISTOGRAM,1,1,Blue);
   SetIndexBuffer(1,ExtMapBuffer2);
   
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//---- TODO: add your code here

  bool firstTime=True;
  int i, loopbegin;
  double SsMax, SsMin, K, val1, val2, smin, smax; 
  
  
  //SetLoopCount(0); 

K=33-RISK; 
if (firstTime==true)   { 
   loopbegin = CountBars; 
   if (loopbegin>(Bars-2*SSP+1)) loopbegin=Bars-2*SSP+1; 
   firstTime=False; 
}; 
for(i=loopbegin;i>=0;i--) { 
   SsMax = High[Highest(MODE_HIGH,i+SSP-1,SSP)]; 
   SsMin = Low[Lowest(MODE_LOW,i+SSP-1,SSP)]; 
   smin = SsMin+(SsMax-SsMin)*K/100; 
   smax = SsMax-(SsMax-SsMin)*K/100; 
   //ExtMapBuffer1[i]=0; 
   //ExtMapBuffer2[i]=0; 
   if (Close[i]<smin) {
      ExtMapBuffer1[i]=High[i]; 
      ExtMapBuffer2[i]=Low[i]; 
   }; 
   if (Close[i]>smax) {
      ExtMapBuffer2[i]=High[i]; 
      ExtMapBuffer1[i]=Low[i]; 
   }; 
if (i>0) loopbegin=loopbegin-1; 
};
  

  
   
//----
   return(0);
  }
//+--------------------



Также хочу спросить, появится ли контекстный словарь, как в МТ3? поиск по словарю?
Спасибо за внимание

 
Ты уже и здесь успел тему открыть. :)
Сделай так:
   SsMax = High[Highest(MODE_HIGH,SSP,i)]; 
   SsMin = Low[Lowest(MODE_LOW,SSP,i)]; 
 
Результат получается абсолютно другой.
Где я ошибся? Или функции Highest && Lowest глючат?

Эти функции в МТ4 немного изменены - сравните описания, пожалуйста.

Также хочу спросить, появится ли контекстный словарь, как в МТ3? поиск по словарю

Контекстный словать в MetaEditor 4 давно уже есть - нажимайте на F1 или Ctrl+F1. Словарь серьезно расширен по сравнению с MetaEditor 3. Поиск добавлен - увидите в билде 153, который выпустим завтра.
 
[quote]
Результат получается абсолютно другой.
Где я ошибся? Или функции Highest && Lowest глючат?

Эти функции в МТ4 немного изменены - сравните описания, пожалуйста.

Спасибо, рад, что поиск по словарю будет :))) Я буду самый первый, кто скачает новый билд :)))
а теперь по поводу функций. Я специально переписывал функцию, сверяясь с описанием. Ниже описание для МТ3

type: MODE_OPEN,MODE_LOW,MODE_HIGH,MODE_CLOSE,MODE_VOLUME
beginbar: a shift showing the bar, relative to the current bar, that the data should be taken from
periods: number of periods (in direction from beginbar to the current bar) on which the calculation is carried out


сама конструкция
SsMax = High[Highest(MODE_HIGH,shift+SSP-1,SSP)];
SsMin = Low[Lowest(MODE_LOW,shift+SSP-1,SSP)];


МТ4
int Highest(string symbol, int timeframe, int type, int count, int start)


Returns the shift of the maximum value over a specific number of periods depending on type.


Parameters

symbol - Symbol on that data need to calculate indicator. NULL means current symbol.
timeframe - time frame. It can be any one of the following values:
PERIOD_M1 - 1 minute,
PERIOD_M5 - 5 minutes,
PERIOD_M15 - 15 minutes,
PERIOD_M30 - 30 minutes,
PERIOD_H1 - 1 hour,
PERIOD_H4 - 4 hour,
PERIOD_D1 - dayly,
PERIOD_W1 - weekly,
PERIOD_MN1 - monthly,
0 - time frame used on the chart.
type - =Calculating mode. It can be any one of the following values:
MODE_OPEN - open price,
MODE_LOW - low price,
MODE_HIGH - hight price,
MODE_CLOSE - close price,
MODE_VOLUME - volume, used in Lowest() and Highest() functions.
count - number of periods (in direction from beginbar to back) on which the calculation is carried out. Default WHOLE_ARRAY.
start - a shift showing the bar, relative to the current bar, that the data should be taken from. Default 0.



SsMax = High[Highest(NULL,0,MODE_HIGH,SSP,i+SSP-1)];
SsMin = Low[Lowest(NULL,0,MODE_LOW,SSP,i+SSP-1)];


результат другой, но, опять не то... отличие от МТ3...
 
Ты уже и здесь успел тему открыть. :)
Сделай так:
   SsMax = High[Highest(MODE_HIGH,SSP,i)]; 
   SsMin = Low[Lowest(MODE_LOW,SSP,i)]; 



Спасибо, но не помагает :(((
 
У меня написано так и работает:
mmin=Low[Lowest(NULL,0,MODE_LOW,per,shift+1)];


Ну забыл я про NULL и 0. :)
Если shift=0 (последний бар), а per=10, то прошерстит с 1-го по 11-ый бар и покажет тот, у которого самый низкий Low в серии из 10 баров.

 
У меня написано так и работает:
mmin=Low[Lowest(NULL,0,MODE_LOW,per,shift+1)];


Ну забыл я про NULL и 0. :)
Если shift=0 (последний бар), а per=10, то прошерстит с 1-го по 11-ый бар и покажет тот, у которого самый низкий Low в серии из 10 баров.



Спасибо :)