MT3 indicator to MT4

 
Hi,

can someone please help to convert the MT3 HistoFractalZigZag indicator to MT4 please? The code is below.

thanks
---------------

/*[[
Name := HistoZZ
Separate Window := Yes
First Color := Red
First Draw Type := Histogram
First Symbol := 217
Use Second Data := No
Second Color := Red
Second Draw Type := Line
Second Symbol := 218
]]*/
Input : Level(2),nBars (400),BuildChanel(0);
Variable : shift(0), zz0(0), zzlast(0);

SetLoopCount(0);
For shift=nBars Downto 0 Begin
zz0=iCustom("ZigZag",Level,nBars,BuildChanel,MODE_FIRST,shift);
if (zz0 > 0) then zzlast = zz0);
SetIndexValue(shift, zzlast);
End;
 
Jo,

Let me know if this works how you would expect, i.e. consistent with MT3 results.

//+------------------------------------------------------------------+
//|                                                      HistoZZ.mq4 |
//|                                Copyright © 2006, Mu Technologies |
//|                                 http://www.mutechnologies.com.au |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Mu Technologies"
#property link      "http://www.mutechnologies.com.au"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern int Level = 2;
extern int nBars = 400;
extern int BuildChanel = 0;
//---- buffers
double ExtHistoBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,ExtHistoBuffer);
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
//---- 
   
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   double zz = 0, zzlast = 0;
   
   // Check for possible errors
   if (IndicatorCounted() < 0)
      return(-1);

   int limit = Bars - IndicatorCounted() - 1;
   for (int iter = 0; iter < limit; iter++) {
      zz = iCustom(NULL, 0, "ZigZag", Level, nBars, BuildChanel, 0, iter);
      if (zz > 0)
         zzlast = zz;
         
      ExtHistoBuffer[iter] = zzlast;   
   }

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



Cheers,

Aaron.

Reason: