bug?

 

Hello


I've faced something that seems to me as a bug. Reading supplied help with MT 4.0.225 I've tried to apply iAlligator function as described.

double jaw_val=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORJAW, 1);

Result is visible on attached picture. For me this is not correct result


I'll appreciate any comments from MT guys.


Here's the result chart: Solid lines are from build-in alligator's indicator. Dashed lines are made by the script quoted bellow


result chart


Here is the source which generate it


//+------------------------------------------------------------------+
//| AlligatorsPart.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 DeepSkyBlue
#property indicator_color2 Magenta
#property indicator_color3 PaleGreen
//---- input parameters
extern bool jaw=true;
extern bool teeth=false;
extern bool lips=false;
//---- buffers
double _jaw[];
double _teeth[];
double _lips[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,_jaw);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,_teeth);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,_lips);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars>0) { counted_bars--; } //---- last counted bar will be recounted
int limit=Bars-counted_bars;
//----
for(int i=0; i<limit; i++)
{
if(jaw) { _jaw[i] = iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMA, PRICE_MEDIAN, MODE_GATORJAW, i); }
if(teeth){ _teeth[i] = iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMA, PRICE_MEDIAN, MODE_GATORTEETH, i); }
if(lips) { _lips[i] = iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMA, PRICE_MEDIAN, MODE_GATORLIPS, i); }
}
//----
return(0);
}
//+------------------------------------------------------------------+

Reason: